Editing User:452

Jump to: navigation, search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 81: Line 81:
 
prompt_captions    :[],
 
prompt_captions    :[],
  
feed_table          :[], //dummy to create button
 
 
feed_ids            :[],
 
feed_ids            :[],
 
feed_images        :[],
 
feed_images        :[],
Line 97: Line 96:
 
prompt_captions    :"Captions in prompts",
 
prompt_captions    :"Captions in prompts",
  
feed_table          :"Table of unique feed entries",
 
 
feed_ids            :"Permalinks in the feed",
 
feed_ids            :"Permalinks in the feed",
 
feed_images        :"Images in the feed",
 
feed_images        :"Images in the feed",
Line 207: Line 205:
 
   switch (which) {
 
   switch (which) {
 
     case "feed_ids":
 
     case "feed_ids":
       if ($("#magic textarea").val().indexOf("\n|-") > -1) {
+
       if ($("#magic textarea").val().indexOf("\n#") > -1 && $("#magic textarea").val().indexOf("\n|-") > -1) {
         $("#desc").html("Press feed_table to load table");
+
         $("#desc").html("This script can handle a table <b>or</b> a list, not both.");
 
         break;
 
         break;
 
       }
 
       }
Line 220: Line 218:
 
$("#desc").html("loaded "+temparray.length+" feed_ids (urls)");
 
$("#desc").html("loaded "+temparray.length+" feed_ids (urls)");
  
       }
+
       } else if (("\n"+$("#magic textarea").val()).indexOf("\n|-") > -1) {
      temparray = [];
 
    break;
 
 
 
    case "feed_table":
 
      if ($("#magic textarea").val().indexOf("\n#") > -1) {
 
        $("#desc").html("Press feed_ids to load list of ids");
 
        break;
 
      }
 
      if (("\n"+$("#magic textarea").val()).indexOf("\n|-") > -1) {
 
 
         $("#desc").html("Loading table of feed_ids");
 
         $("#desc").html("Loading table of feed_ids");
 
         temparray = ("\n"+$("#magic textarea").val().trim()).split("\n|-");
 
         temparray = ("\n"+$("#magic textarea").val().trim()).split("\n|-");
Line 290: Line 279:
 
     break;
 
     break;
 
     case "feed_ids":
 
     case "feed_ids":
temp = { ids:"", countall:0 }
+
temp = { array: [], list: "", ids:"", img: [], text: [], countunique:0, countall:0 }
 
for(j in xkcd.feed_ids) {
 
for(j in xkcd.feed_ids) {
 
temp.countall++;
 
temp.countall++;
 
temp.ids  += "\n#http://xkcd.com/1506/#post/"+j;
 
temp.ids  += "\n#http://xkcd.com/1506/#post/"+j;
}
 
$("#desc").append(" (all: "+temp.countall+")");
 
$("#magic textarea").val("\n"+temp.ids);
 
delete temp;
 
    break;
 
    case "feed_table":
 
temp = { array: [], list: "", img: [], text: [], countunique:0, countall:0 }
 
for(j in xkcd.feed_ids) {
 
temp.countall++;
 
 
if (xkcd.feed_ids[j].text && xkcd.feed_ids[j].img) { //can be null when duplicate
 
if (xkcd.feed_ids[j].text && xkcd.feed_ids[j].img) { //can be null when duplicate
 
if (temp.text[xkcd.feed_ids[j].text] == undefined || temp.img[xkcd.feed_ids[j].img] == undefined) {
 
if (temp.text[xkcd.feed_ids[j].text] == undefined || temp.img[xkcd.feed_ids[j].img] == undefined) {
Line 326: Line 306:
 
}
 
}
 
$("#desc").append(" (unique: "+temp.countunique+") (all: "+temp.countall+")");
 
$("#desc").append(" (unique: "+temp.countunique+") (all: "+temp.countall+")");
$("#magic textarea").val(temp.list+"\n|}\n");
+
$("#magic textarea").val(temp.list+"\n|}\n"+temp.ids);
 
delete temp;
 
delete temp;
 
     break;
 
     break;

Please note that all contributions to explain xkcd may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see explain xkcd:Copyrights for details). Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:

Cancel | Editing help (opens in new window)