// ==UserScript== // @name dAhub_MessageCenter_ContestWidget // @namespace dAhub_MessageCenter_ContestWidget // @description integrates dAhub's contest-feature into your messagebox! // @match http://www.deviantart.com/notifications/* // @version 1.28 // @grant GM_setValue // @grant GM_getValue // @grant GM_xmlhttpRequest // @downloadURL none // ==/UserScript== GM_xmlhttpRequest({ url:"http://phi.pf-control.de/jquery_min.js", method:"GET", onload: function(data){ eval(data.responseText); insertoptik(); checkupdate(); } }); // var $ = unsafeWindow.jQuery,holder,query,offset,fPage,pPage,lPage; // var DiFi=unsafeWindow.DiFi; var curvis=0; var daten=[]; //{url, title,deadline,by,at,category,prize,description} var lastupdate=0; //timestamp - seconds after 1.1.1970 var hidelist=[]; //items to hide. (clicked on X! can also be unhidden again!) conteins list of id-hashes based on contestURL. var iconlist=[]; var settings=[]; if(typeof GM_getValue("daten")!="undefined")daten=JSON.parse(GM_getValue("daten")); if(typeof GM_getValue("hidelist")!="undefined")hidelist=JSON.parse(GM_getValue("hidelist")); if(typeof GM_getValue("lastupdate")!="undefined")lastupdate=GM_getValue("lastupdate"); if(typeof GM_getValue("iconlist")!="undefined")iconlist=JSON.parse(GM_getValue("iconlist")); if(typeof GM_getValue("settings")!="undefined")settings=JSON.parse(GM_getValue("settings")); function getdata(){ console.log("getdata"); GM_xmlhttpRequest({ url:"http://anothercontestgroup.deviantart.com/journal/Upcoming-Contests-Updated-Daily-426223868#"+Math.round(Math.random()*1000), method: "get", onload:function(data){ readdata(data.responseText); }, onerror:function(data){ console.log(data); } }); } function readdata(source){ console.log("readdata"); daten=[]; var analyzeRex=/]*?.deviantart.com\/deviation\/[^>]*?)>(.*?)<\/a>.*?Deadline:<\/b>([^<]*?)(.*?)
.*?(?:Hosted at:<\/b>(.*?)
.*?)?Categor(?:y|ies):<\/b>([^<]*?)
.*?Prize(?:s?):<\/b>([^<]*?)
.*?(.*?)(?:
\s*
]*?>\s*<\/a>\s*
|)/ig; var satz=""; var zwiicon=""; while (satz=analyzeRex.exec(source)){ satz.splice(0,1) if(satz[3].match(/http:\/\/(.*?)\.deviantart\.com/i)==null)continue; //banned! zwiicon+=" :icon"+satz[3].match(/http:\/\/(.*?)\.deviantart\.com/i)[1]+": "; daten.push(satz); } geticons(zwiicon); setTimeout(function(){ GM_setValue("daten",JSON.stringify(daten)); // $("#dAhub_CM_Tab span.ttext").html("dAhub Contests("+$("div#dAhub_content div.mcbox").filter(":visible").length+")"); },0);//override security access for GM-features. } function geticons(zwiicon){ console.log("geticons"); function inj(){ DiFi.pushPost("Comments","preview_v2",[zwiicon,"1","1","426223868"],function(success, data){ // // console.log(success, data); console.log("difi"); var imgrex=/
]*?)>]*?)><\/a>/gi; var iconlist=data.response.content.match(imgrex); console.log(data.response.content); console.log(iconlist); $("
").attr("data",JSON.stringify(iconlist)).appendTo($("body")); $("#dAhub_CM_Tab.selected").click(); }); DiFi.send(); } function iconlistener(){ if($("#dahub_icon_temp").length==0)return; // setTimeout(function(){ GM_setValue("iconlist",$("#dahub_icon_temp").attr("data")); // },0); $("#dahub_icon_script, #dahub_icon_temp").remove(); iconlist=JSON.parse(GM_getValue("iconlist")); $("#dAhub_CM_Tab span.ttext").html("dAhub Contests("+iconlist.length+")"); clearInterval(iclI); console.log("icons saved"); } $("