Plugin/Code Troubleshooting

Page 2 of 13 Previous  1, 2, 3, ... 11, 12, 13  Next

View previous topic View next topic Go down

Re: Plugin/Code Troubleshooting

Post  essence33 on Fri Dec 16, 2011 3:08 pm

yay! it worked! i'm off to reading your fabulous translations now Wink

essence33
Newbie
Newbie

Posts : 4
Join date : 2011-12-15

View user profile

Back to top Go down

Re: Plugin/Code Troubleshooting

Post  essence33 on Fri Dec 16, 2011 3:31 pm

hi, i was able to read the first page translated of chapter 25.5, but not any other page. Help again, please!


essence33
Newbie
Newbie

Posts : 4
Join date : 2011-12-15

View user profile

Back to top Go down

Re: Plugin/Code Troubleshooting

Post  noobzilla on Fri Dec 16, 2011 11:39 pm

It looks like you didn't insert any code at all here. Again make sure you are copy pasting the code for the right chapter. Example: If you wanna read chapter 26 open, chapter 26, then use the code that is written beside the chapter 26 link. Please post another screenshot which shows what happens after you input the code

noobzilla
Admin

Posts : 266
Join date : 2010-12-25

Character sheet
Name: Jung
Class: Very High.
Race: Human

View user profile http://oddsquad.userboard.net

Back to top Go down

Re: Plugin/Code Troubleshooting

Post  essence33 on Sat Dec 17, 2011 6:57 pm

You were right, I simply didn't enter the proper code. I completely forgot that each time I click to go onto the next page, it's a new chapter...pretty dumb, huh.

essence33
Newbie
Newbie

Posts : 4
Join date : 2011-12-15

View user profile

Back to top Go down

Won't show me the translated page...

Post  DorkFishOK on Mon Dec 19, 2011 12:57 am

I tried to view CITT through the instructions for chrome but everytime I press enter a red X appears on the console saying, "Unsafe Javascript attempt to access frame with URL" above it a triangle with an exclamation mark says, "Resource interpreted as Other but transferred with MIME type undefined." I don't know if I have a blocker and how I would disable it. Sometimes when I press Ctrl + Shift + I the console box won't fully appear so I don't know if that's a part of the problem either. Should I email a screenshot? I don't know how to paste one on a forum Sad

DorkFishOK
Newbie
Newbie

Posts : 4
Join date : 2011-12-19

View user profile

Back to top Go down

Re: Plugin/Code Troubleshooting

Post  noobzilla on Mon Dec 19, 2011 2:03 am

Read the first post in this thread.

noobzilla
Admin

Posts : 266
Join date : 2010-12-25

Character sheet
Name: Jung
Class: Very High.
Race: Human

View user profile http://oddsquad.userboard.net

Back to top Go down

suggestion

Post  tenten on Fri Dec 23, 2011 10:48 am

You're idea on the whole using png transparency is brilliant -- solves so many problems at once.

A suggestion: I don't know if you've considered this, but if you loaded the chapter on your site into an iframe (you could put it in your own 'reader'), and then use your script to manipulate the documentContent of the iframe on document load / domcontentloaded. Since you are simply overlaying pngs (and not doing any script injection) it should work just fine, and makes it virtually painless on the user.

tenten
Newbie
Newbie

Posts : 1
Join date : 2011-12-23

View user profile

Back to top Go down

Re: Plugin/Code Troubleshooting

Post  noobzilla on Fri Dec 23, 2011 11:00 pm

Yep I considered that, except I haven't figured out how to do it, specially since its a blog we are using.

noobzilla
Admin

Posts : 266
Join date : 2010-12-25

Character sheet
Name: Jung
Class: Very High.
Race: Human

View user profile http://oddsquad.userboard.net

Back to top Go down

Re: Plugin/Code Troubleshooting

Post  Doonge on Wed Jan 18, 2012 8:45 am

I've had no problem at all with the javascript injection technique, though I don't use it anymore.

I've read some people have trouble though, and while you may be satisfied now, you could modify the src and the style (background) of the images instead of creating HTML code into naver (appendChild, createElement('div')). This way, there should be no alignement problem, be it vertical or horizontal.

But the problem with that technique is that you couldn't cut your .png image into 8 pieces which you are doing now, and since I can't understand why, I suppose it might be annoying.




If you still seek cleaners, I might give it a shot (I have minor experience, don't expect much, but since you claim it's easy ...).

Doonge
Artisan
Artisan

Posts : 754
Join date : 2012-01-18

View user profile

Back to top Go down

Re: Plugin/Code Troubleshooting

Post  noobzilla on Wed Jan 18, 2012 12:02 pm

Err I donno how to do that... tell me~

noobzilla
Admin

Posts : 266
Join date : 2010-12-25

Character sheet
Name: Jung
Class: Very High.
Race: Human

View user profile http://oddsquad.userboard.net

Back to top Go down

Re: Plugin/Code Troubleshooting

Post  Doonge on Wed Jan 18, 2012 12:38 pm

Here's a portion of the HTML code you can read at naver (CitT chap 26 2nd season).

<img src="http://imgcomic.naver.com/webtoon/186811/76/20111214214332_IMAG01_1.jpg" title="" id="content_image_0" onload="loadImageEvent(this);" oncontextmenu="return false" ondragstart="return false" onselectstart="return false" >

That's one of the images of the webtoon.

src="" gives the adress of the image, and one thing interesting is that this image has an ID
id="content_image_#number"

And you use a png image, which adress is something like
OddSquad image : "http://imageshack .... .png"

Using the following HTML code gives good results in Firefox (didn't test much, but it should be good) :
<img src="http://imageshack .... .png" style="background:url('http://imgcomic.naver.com/webtoon/186811/76/20111214214332_IMAG01_1.jpg')" id="content_image_0" ... >

Just create an HTML file to test it.


Anyway, since you use javascript to alter the page, you could simply

1°) one by one, get each of the images through getElementById (or something like that)
var obj = document.getElementById("content_image_" + current_number)

2°) for each, set a special style (since they have an ID, they may be uniquely stylised) : set the background to be the src image.
obj.setAttribute("style","background:url('"+obj.getAttribute("src")+"')");

3°) change the src to your own .png image.
obj.setAttribute("src",oddsquad_image[current_number])

Doonge
Artisan
Artisan

Posts : 754
Join date : 2012-01-18

View user profile

Back to top Go down

Re: Plugin/Code Troubleshooting

Post  Doonge on Wed Jan 18, 2012 5:51 pm

For instance, under Firefox 8 and pushing Shift + F4 to get the javascript console, I just have to type

var OddSquad_Images_chap25 = new Array(
"http://img854.imageshack.us/img854/4535/s125p01.png",
"http://img690.imageshack.us/img690/5261/s1c25p02a01.png",
"http://img64.imageshack.us/img64/2707/s1c25p0301.png",
"http://img847.imageshack.us/img847/3833/s1c25p0401.png"
);

var current_ID = 0;
for(var current_ID = 0;current_ID < OddSquad_Images_chap25.length;current_ID++)
{
var obj = document.getElementById("content_image_" + current_ID);
obj.setAttribute("style","background:url('"+obj.getAttribute("src")+"')");
obj.setAttribute("src",OddSquad_Images_chap25[current_ID]);
}

And booya, it works (though images are clipped since you cut the .png files).

Another solution might exists through custom .css preferences, I'm digging that up right now.

Doonge
Artisan
Artisan

Posts : 754
Join date : 2012-01-18

View user profile

Back to top Go down

Re: Plugin/Code Troubleshooting

Post  noobzilla on Thu Jan 19, 2012 4:43 am

Nifty yes, but the problem with this is that if one of our image links are broken, it's corresponding original is removed too. With chrome the original totally disappears with only the translations on a white background...

edit: okay the chrome thing can be fixed by setting obj zindex to 2 - but problem remains... raw image disappears if our translation isn't there...

noobzilla
Admin

Posts : 266
Join date : 2010-12-25

Character sheet
Name: Jung
Class: Very High.
Race: Human

View user profile http://oddsquad.userboard.net

Back to top Go down

Re: Plugin/Code Troubleshooting

Post  Doonge on Thu Jan 19, 2012 10:11 am

You may check if the image exists by waiting the onload event, then checking anything (width, for instance) : if it doesn't exist, swap isn't needed.


var OddSquad_URLs = new Array(
"http://img854.imageshack.us/img854/4535/s125p01.png",
"http://img690.imageshack.us/img690/5261/s1c25p02a01.png",
"http://img64.imageshack.us/img64/2707/s1c25p0301.png",
"http://img847.imageshack.us/img847/3833/s1c25p0401.png"
);

for(var current_ID = 0;current_ID < OddSquad_URLs.length;current_ID++)
{
OddSquad_Images[current_ID] = new Image();
OddSquad_Images[current_ID].src = OddSquad_URLs[current_ID];
OddSquad_Images[current_ID].onLoad = OddSquad_Swap(current_ID);
}

function OddSquad_Swap(ID)
{
var obj = document.getElementById("content_image_" + ID);
if(OddSquad_Images[ID].width && obj)
{
obj.setAttribute("style","background:url('"+obj.getAttribute("src")+"')");
obj.setAttribute("src",OddSquad_Images[ID].src);
}
}

If you put a "false" adress in the OddSquad_URLs, the swap won't be made.

However, there is a problem since the 4th image from the 25th chapter does not have any ID.
So, it's far from good, your actual solution is better (especially since it allows you to cut your .png files, which is convenient if that pleases imageshack and/or viewer's speed).


Last edited by Doonge on Thu Jan 19, 2012 10:52 am; edited 1 time in total

Doonge
Artisan
Artisan

Posts : 754
Join date : 2012-01-18

View user profile

Back to top Go down

Re: Plugin/Code Troubleshooting

Post  noobzilla on Thu Jan 19, 2012 10:51 am

erm there are only 3 raw images in chapter 25... why a fourth image... anyway i tried it on chapter 35... didn't work...

noobzilla
Admin

Posts : 266
Join date : 2010-12-25

Character sheet
Name: Jung
Class: Very High.
Race: Human

View user profile http://oddsquad.userboard.net

Back to top Go down

Re: Plugin/Code Troubleshooting

Post  Doonge on Thu Jan 19, 2012 11:00 am

http://imgcomic.naver.com/webtoon/186811/26/20101222172545_IMAG01_4.jpg is the fourth image (?).

chap 35 works fine for me, I don't know why it doesn't with you. Anyway no big deal, since your actual solution is prob. better.

var OddSquad_URLs = new Array(
"http://img833.imageshack.us/img833/5935/s1c35p0101.png",
"http://img819.imageshack.us/img819/112/s1c35p0201.png",
"http://img13.imageshack.us/img13/8721/s1c35p0301.png"
);
var OddSquad_Images = new Array();

for(var current_ID = 0;current_ID < OddSquad_URLs.length;current_ID++)
{
OddSquad_Images[current_ID] = new Image();
OddSquad_Images[current_ID].src = OddSquad_URLs[current_ID];
OddSquad_Images[current_ID].onLoad = OddSquad_Swap(current_ID);
}

function OddSquad_Swap(ID)
{
var obj = document.getElementById("content_image_" + ID);
if(OddSquad_Images[ID].width && obj)
{
obj.setAttribute("style","background:url('"+obj.getAttribute("src")+"')");
obj.setAttribute("src",OddSquad_Images[ID].src);
}
}

Doonge
Artisan
Artisan

Posts : 754
Join date : 2012-01-18

View user profile

Back to top Go down

Re: Plugin/Code Troubleshooting

Post  noobzilla on Thu Jan 19, 2012 1:04 pm

yay it works. I would use this for 38 onwards since naver started using smaller images from that point onwards. If an ID is missing we can always use the old style for a chapter.

noobzilla
Admin

Posts : 266
Join date : 2010-12-25

Character sheet
Name: Jung
Class: Very High.
Race: Human

View user profile http://oddsquad.userboard.net

Back to top Go down

Re: Plugin/Code Troubleshooting

Post  Doonge on Thu Jan 19, 2012 5:53 pm

Okay, for the onload to trigger properly at the first connection (when images are not yet in the cache), a little correction is to be made :

var OddSquad_URLs = new Array(
"http://img833.imageshack.us/img833/5935/s1c35p0101.png",
"http://img819.imageshack.us/img819/112/s1c35p0201.png",
"http://img13.imageshack.us/img13/8721/s1c35p0301.png"
);
var OddSquad_Images = new Array();

for(var current_ID = 0;current_ID < OddSquad_URLs.length;current_ID++)
{
OddSquad_Images[current_ID] = new Image();
OddSquad_Images[current_ID].id = current_ID;
OddSquad_Images[current_ID].onload = function(){OddSquad_Swap(this.id);};
OddSquad_Images[current_ID].src = OddSquad_URLs[current_ID];

}

function OddSquad_Swap(ID)
{
var obj = document.getElementById("content_image_" + ID);
if(OddSquad_Images[ID].width && obj)
{
obj.setAttribute("style","background:url('"+obj.getAttribute("src")+"')");
obj.setAttribute("src",OddSquad_Images[ID].src);
}
}

1°) set the onload trigger before src declaration.

2°) onload = function() { what should be done at that moment; };

I made bold what essentially changed.



You are aware using this method prevents you from cutting .png files (which could be convenient, I don't know, I just saw you do that), and it is ineffective when parts of the webcomic are meant to be loaded through naver javascript (can not be spotted in the HTML source, and does not have any id).

Doonge
Artisan
Artisan

Posts : 754
Join date : 2012-01-18

View user profile

Back to top Go down

Re: Plugin/Code Troubleshooting

Post  Doonge on Thu Jan 19, 2012 6:03 pm

From what I can see, even though the background glitch is appealing (well, to me), as you said, naver uses smaller images, which mean more than 3.
Meaning using the IDs won't work long : naver limits the ID to 3 (that's why I had problems with image #4 for the 25th chapter).




Not a big deal, since it should be possible to just scan the images, and detect the good ones from their name (they are all stored in the same directory).

I'm on it, and I would be interested in seeing the firefox plugin code.

Doonge
Artisan
Artisan

Posts : 754
Join date : 2012-01-18

View user profile

Back to top Go down

Re: Plugin/Code Troubleshooting

Post  noobzilla on Fri Jan 20, 2012 3:08 am

I don't have the working version of the addon with me at the moment, i'll post it later. But yeah the addon is working nicely~ will use that for 38 once its done~

noobzilla
Admin

Posts : 266
Join date : 2010-12-25

Character sheet
Name: Jung
Class: Very High.
Race: Human

View user profile http://oddsquad.userboard.net

Back to top Go down

Re: Plugin/Code Troubleshooting

Post  Doonge on Fri Jan 20, 2012 9:02 am

Here's the working javascript (chap 25 as example) that swaps src and background for every images of the webcomic if there is a valid OddSquad's image found.

It could be improved with a JSON request, so a single javascript file could work for any chapter, requiring you to create the JSON file (it's just a .txt file which looks like the OddSquad_URLs variable), next step being then the firefox or chrome plugin.


var OddSquad_URLs = new Array(
"http://img854.imageshack.us/img854/4535/s125p01.png",
"http://img690.imageshack.us/img690/5261/s1c25p02a01.png",
"http://img64.imageshack.us/img64/2707/s1c25p0301.png",
"http://img847.imageshack.us/img847/3833/s1c25p0401.png"
);
var OddSquad_Images = new Array();

var ref_src = document.getElementById("content_image_0").src.slice(0,-5);

for (var i = 0; i < document.images.length; i++)
{
if(document.images[i].src.substr(0,ref_src.length) == ref_src)
{
var img_number = document.images[i].src.substr(ref_src.length,3);
img_number = img_number.substr(0,img_number.indexOf(".")) - 1;
if(OddSquad_URLs[img_number])
{
OddSquad_Images[img_number] = new Image();
OddSquad_Images[img_number].id = i;
OddSquad_Images[img_number].onload = function(){OddSquad_Swap(this);};
OddSquad_Images[img_number].src = OddSquad_URLs[img_number];
}
}
}

function OddSquad_Swap(OddSquad_Image)
{
var obj = document.images[OddSquad_Image.id];
if(OddSquad_Image.width && obj)
{
obj.setAttribute("style","background:url('"+obj.getAttribute("src")+"')");
obj.setAttribute("src",OddSquad_Image.src);
}
}

Doonge
Artisan
Artisan

Posts : 754
Join date : 2012-01-18

View user profile

Back to top Go down

Re: Plugin/Code Troubleshooting

Post  misato17 on Mon Jan 23, 2012 5:49 pm

I followed your instructions but I still don't know what I did wrong. Instead of the translations this comes out:
[img]http://www.servimg.com/image_preview.php?i=2&u=17214098][/url]
What am i doing wrong? Please help me. TIA

misato17
Newbie
Newbie

Posts : 4
Join date : 2012-01-23

View user profile

Back to top Go down

Re: Plugin/Code Troubleshooting

Post  noobzilla on Mon Jan 23, 2012 11:04 pm

Err okay, you have done everything correctly but for some reason imageshack doesn't like your IP, we are going to switch to a different host, but meanwhile your only solution is to make an account in imageshack.us

noobzilla
Admin

Posts : 266
Join date : 2010-12-25

Character sheet
Name: Jung
Class: Very High.
Race: Human

View user profile http://oddsquad.userboard.net

Back to top Go down

Re: Plugin/Code Troubleshooting

Post  misato17 on Tue Jan 24, 2012 12:22 am

I made an imageshack account and now it works. Thanks very much!!! Very Happy
But would you know why, as you said, imageshack doesn't like my IP in the first place?


Last edited by misato17 on Wed Jan 25, 2012 1:47 am; edited 1 time in total

misato17
Newbie
Newbie

Posts : 4
Join date : 2012-01-23

View user profile

Back to top Go down

Re: Plugin/Code Troubleshooting

Post  noobzilla on Tue Jan 24, 2012 9:17 am

I don't know why its you specifically and not the rest but I do know that imageshack wants people to either register or the owner of the site where we are publishing the image to register with them. Unfortunately we don't own naver, so we can't go and register naver domain to imageshack.

noobzilla
Admin

Posts : 266
Join date : 2010-12-25

Character sheet
Name: Jung
Class: Very High.
Race: Human

View user profile http://oddsquad.userboard.net

Back to top Go down

Re: Plugin/Code Troubleshooting

Post  Sponsored content Today at 11:10 am


Sponsored content


Back to top Go down

Page 2 of 13 Previous  1, 2, 3, ... 11, 12, 13  Next

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum