{deviantART} Add Submission Post Dates

By Wolfey Last update Jun 2, 2011 — Installed 210 times.


Script Summary: Adds the date a submission was posted under that submission's title.

Script homepage

Notice

As of January 14, 2011, the script will now run automatically! =D Changes were made to how deviantART galleries are loaded, which means that I do not need to fix the "User Script: Now Works Automatically, But Runs Multiple Times" issue.

Usage Notes

To test it out, execute this script in anything that will run it (such as Firebug or a Javascript shell bookmarklet), or create a bookmarklet from the line below (this script, minus the comments to conserve space) and run it:

Script Code

var daAddDates=function(){var currentItem,currentItemNode,currentItemTitle,itemDate,itemDateLocation,itemDateSpan,itemDateSpanText,itemDay,itemFullDate,itemLineBreak,itemMonth,itemYear,thumbnailPreviews="";thumbnailPreviews=document.getElementById("gmi-ResourceStream");for(currentItem=0;currentItem<thumbnailPreviews.getElementsByTagName("div").length;currentItem=currentItem+1){if(thumbnailPreviews.getElementsByTagName("div")[currentItem].getAttribute("class")!==null){if(thumbnailPreviews.getElementsByTagName("div")[currentItem].getAttribute("class").split(" ")[0]==="tt-a"){currentItemNode=thumbnailPreviews.getElementsByTagName("div")[currentItem];itemFullDate="";itemDate=currentItemNode.getElementsByTagName("a")[1].getAttribute("title");itemDateLocation=itemDate.match("[A-z]{3} [0-9]{1,2}, [0-9]{4}");itemDateLocation=String(itemDateLocation);itemDateLocation=itemDateLocation.replace(",","");itemDay=itemDateLocation.split(" ")[1];itemMonth=itemDateLocation.split(" ")[0];itemYear=itemDateLocation.split(" ")[2];if(itemDay<10){itemDay="0"+itemDay;}if(itemMonth==="Jan"){itemMonth="01";}else if(itemMonth==="Feb"){itemMonth="02";}else if(itemMonth==="Mar"){itemMonth="03";}else if(itemMonth==="Apr"){itemMonth="04";}else if(itemMonth==="May"){itemMonth="05";}else if(itemMonth==="Jun"){itemMonth="06";}else if(itemMonth==="Jul"){itemMonth="07";}else if(itemMonth==="Aug"){itemMonth="08";}else if(itemMonth==="Sep"){itemMonth="09";}else if(itemMonth==="Oct"){itemMonth="10";}else if(itemMonth==="Nov"){itemMonth="11";}else if(itemMonth==="Dec"){itemMonth="12";}itemFullDate=itemMonth+"/"+itemDay+"/"+itemYear;itemDateSpan=document.createElement("span");itemLineBreak=document.createElement("br");itemDateSpanText=document.createTextNode(itemFullDate);itemDateSpan.setAttribute("id","item_date");itemDateSpan.setAttribute("style","display:block;font-size:smaller;");itemDateSpan.appendChild(itemDateSpanText);currentItemTitle=currentItemNode.getElementsByTagName("a")[1];currentItemNode.appendChild(itemDateSpan);}else if(thumbnailPreviews.getElementsByTagName("div")[currentItem].getAttribute("class")==="tt-a tt-special"){thumbnailPreviews.getElementsByTagName("div")[currentItem].setAttribute("style","vertical-align:top;");}}}};daAddDates();

Updates

June 2, 2011

  • Revised the code so that it no longer breaks on deviantART galleries; recent changes to how they are loaded had caused the script to break.
  • Consolidated all variable declarations into a single line near the beginning.
  • Removed "var" from the beginning of all lines where a variable was being set (due to what was mentioned in the previous list item).
  • Updated the bookmarklet code above to use the code from the updated script.

January 14, 2011

  • Revised the code so that it no longer breaks on deviantART galleries; recent changes to how they are loaded had caused the script to break.
  • Updated the bookmarklet code above to use the code from the updated script.
  • Updated the notice requesting that I need help with fixing an issue with the script: due to changes in how galleries are loaded, that issue no longer needs to be fixed.

December 27, 2009

  • Removed the notice stating that I am no longer maintaining this script.
  • Added a notice requesting that I need help with fixing an issue with the script: it runs multiple times per page, but should only run one time per page.

July 15, 2009

  • Added a notice stating that I am no longer maintaining this script.
  • Added a few headings to this script's page for easier navigation.

January 24, 2009

  • Revised the code that extracts the submission date - it will no longer break as a result of the layout change.

November 15, 2008

  • Added a condition to skip over the first item, if it's an advertisement - it will no longer break if there is an advertisement on the page (thank you, teukkam!).

November 13, 2008

  • Rewrote the code that extracts the submission date - it will no longer break if the submission is a film.