diff --new-file --recursive --suppress-common-lines --exclude changes.txt --exclude diff.txt releases/unplug-2.027/source/chrome/content/common.js releases/unplug-2.028/source/chrome/content/common.js 135c135 < version : 2.027, --- > version : 2.028, 139c139 < revision : 201007110522, --- > revision : 201007302040, diff --new-file --recursive --suppress-common-lines --exclude changes.txt --exclude diff.txt releases/unplug-2.027/source/chrome/content/rules.xml releases/unplug-2.028/source/chrome/content/rules.xml 40a41,51 > > youtube.com > addthis.com > xtendmedia.com > doubleclick.net > googlesyndication.com > yieldmanager.com > admeld.com > invitemedia.com > quantserve.com > 41a53 > 413c425,481 < --- > > > > (addParam|addVariable)\s*\(\s*["'](image|thumbnail)["']\s*,\s*["'](.*?)["']\s*\) > > > > > > > > addVariable\('srv','([^']+)'\) > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > 448,459d515 < < < < addVariable\("options", "(http%3A%2F%2Fwww.pornhub.com%2Fmx_player_(?:dev_)?config\.php.*?)"\); < < < < <flv_url>(.*?)</flv_url> < /videos/(\d+/\d+/\d+)/\d+.flv < < < 495c551 < --- > 605,626d660 < < < < < (addParam|addVariable)\s*\(\s*["'](image|thumbnail)["']\s*,\s*["'](.*?)["']\s*\) < < < < < < < < addVariable\('srv','([^']+)'\) < < < < < 763,778d796 < < < < < < < < < < < < < < < < diff --new-file --recursive --suppress-common-lines --exclude changes.txt --exclude diff.txt releases/unplug-2.027/source/chrome/content/search/rules.js releases/unplug-2.028/source/chrome/content/search/rules.js 149c149 < throw statement_name + " is not a rule which has been implemented in " + UnPlug2.version + " " + UnPlug2.revision; --- > throw "Rule " + rule + " is not a rule which has been implemented in " + UnPlug2.version + " " + UnPlug2.revision; 475a476 > // x = (x || "").replace(RegExp("^\\s+|\\s+$", "g"), "") // strip whitespace 523a525,527 > if (!result.innerHTML) { > got_all_required = false; > } diff --new-file --recursive --suppress-common-lines --exclude changes.txt --exclude diff.txt releases/unplug-2.027/source/chrome/content/search/search.js releases/unplug-2.028/source/chrome/content/search/search.js 37a38 > this._post_data = post_data; 43a45 > this._timeout_delay = timeout; 45a48 > this._started = false; 61,71d63 < this._timeout = window.setTimeout(function () { realthis._timeout_callback(); }, timeout); < < if (post_data) { < this._xmlhttp.open('POST', url, true); < this._xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); < this._xmlhttp.send(post_data); < } else { < this._xmlhttp.open('GET', url, true); < this._xmlhttp.send(null); < } < 75a68,98 > * Returns true if the download has started > */ > is_started : function () { > return this._started || this._done; > }, > > /** > * Starts the download > */ > start : function () { > if (this._started) { > return; > } > this._started = true; > if (this._done) { > return; // this is set on cancel. > } > var realthis = this; > this._timeout = window.setTimeout(function () { realthis._timeout_callback(); }, this._timeout_delay); > > if (this._post_data) { > this._xmlhttp.open('POST', this.url, true); > this._xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); > this._xmlhttp.send(this._post_data); > } else { > this._xmlhttp.open('GET', this.url, true); > this._xmlhttp.send(null); > } > }, > > /** 78c101 < complete : function () { --- > is_complete : function () { 109a133 > this.clear_timeout() 120a145 > this.clear_timeout() 139c164 < clear_timout : function () { --- > clear_timeout : function () { 302c327,334 < * ${random:float} --- > * ${randomfloat} > */ > case "randomfloat": > if (parts.length != 0) > throw "Cannot parse ${randomfloat}"; > return Math.random(); > /** > * ${randomint:numchars} 304c336 < case "random": --- > case "randomint": 306,309c338,341 < throw "Cannot parse ${random:...}"; < switch (parts[0]) { < case "float": < return Math.random(); --- > throw "Cannot parse ${randomint:...}"; > var r = ""; > for (var i = 0; i < parseInt(parts[0]); ++i) { > r += "0123456789"[Math.floor(Math.random() * 10)]; 311c343 < throw "Unknown ${random:...} " + parts[0]; --- > return r 399a432,444 > /** > * ${youku:....} > */ > case "youku": > if (parts.length != 5) { > throw "wrong number of args for youku"; > } > var key1 = this._subst_apply_functions([parts[4]]); > var key2 = this._subst_apply_functions([parts[3]]); > var seed = this._subst_apply_functions([parts[2]]); > var streamid = this._subst_apply_functions([parts[1]]); > var pieceid = this._subst_apply_functions([parts[0]]); > return this.youku_url(key1, key2, seed, streamid, pieceid); 464a510,553 > youku_url : (function (key1, key2, randomseed, streamid, piece_num) { > var r = (function () { return "0123456789"[Math.floor(Math.random() * 10)] }); > > // get the codebook like in cg_hun() > var codebook = "" > var t = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/\\:._-1234567890" > randomseed = parseInt(randomseed) > while (t.length > 0) { > randomseed = ((randomseed * 211) + 30031) % 65536; > var idx = Math.floor(randomseed * t.length / 65536); > var c = t.charAt(idx); > if (!c) { throw "Youku: infinite loop of doom at " + idx.toSource() + " of " + t.toSource() + " => " + c.toSource() ; } > codebook += c; > t = t.replace(c, ""); > } > > // decode the uuid like in cg_fun() > var fileid = ""; > var fileid_stars = streamid.split("*"); > fileid_stars.pop(); > for (var i = 0; i < fileid_stars.length; ++i) { > fileid += codebook[parseInt(fileid_stars[i])]; > } > > // make the url > var url = []; > url.push("http://f.youku.com/player/getFlvPath/sid/"); > url.push(Math.floor((new Date()).getTime())) > for (var i = 0; i < 11; ++i) { > url.push(r()); > } > url.push("_"); > url.push(piece_num); > url.push("/st/flv/fileid/"); > url.push(fileid.substring(0, 8)); > url.push(piece_num); > url.push(fileid.substring(8, fileid.length)); > url.push("?K="); > url.push((parseInt(key1, 16) ^ 0xa55aa5a5).toString(16).toLowerCase()); // xor > url.push(key2); > url.push("&myp=0&ts=" + r() + r() + r()); > return url.join(""); > }), > 487d575 < * This doesn't actually queue right now, but just goes and downloads it 500c588,616 < UnPlug2Search._downloads[dl_id] = { rules_to_apply: rules_to_apply, variables : variables, download: null, nsiuri: url }; --- > // set priority from download-priority hook > priority = 50; > for each (node in UnPlug2Search.get_hooks("download-priority")) { > for each (child in node.getElementsByTagName("priority")) { > if (url.host.indexOf(child.textContent) < 0) { > continue; > } > switch (child.getAttribute("level")) { > case "very-high": priority -= 20; break; > case "high": priority -= 10; break; > case "normal": break; > case "low": priority += 10; break; > case "very-low": priority += 20; break; > case "never": > UnPlug2.log("Not downloading " + url.spec + " because forbidden in download-priority hook"); > return; > default: > UnPlug2.log("Invalid priority for download-priority hook " + child.getAttribute("level")); > break; > } > } > } > > UnPlug2Search._downloads[dl_id] = { > rules_to_apply: rules_to_apply, > variables : variables, > download: null, > nsiuri: url, > priority : priority }; 510c626 < UnPlug2.log("Download began " + UnPlug2Search._downloads[dl_id].download); --- > UnPlug2.log("Download queued " + UnPlug2Search._downloads[dl_id].download + " priority " + UnPlug2Search._downloads[dl_id].priority); 512c628 < UnPlug2.log("Download failed for " + UnPlug2Search._downloads[dl_id].download + " because " + e); --- > UnPlug2.log("Download failed to be queued for " + UnPlug2Search._downloads[dl_id].download + " because " + e); 514c630,681 < UnPlug2Search._downloads[dl_id] = null; --- > UnPlug2Search._downloads[dl_id].download = null; > } > UnPlug2Search._do_download_poll = true; > }, > > poll : function () { > if (UnPlug2Search._stopped) { > return; > } > > if (UnPlug2Search._do_download_poll) { > UnPlug2Search._do_download_poll = false; > UnPlug2Search._download_poll(); > } > }, > > /** > * Should be called regularly to start queued downloads > */ > _download_poll : function () { > var concurrent_downloads = 5; // XXX CONFIGURABLE > for (var i = 0; i < UnPlug2Search._downloads.length; i++) { > if (UnPlug2Search._downloads[i] > && UnPlug2Search._downloads[i].download > && UnPlug2Search._downloads[i].download.is_started() == true > && UnPlug2Search._downloads[i].download.is_complete() == false) { > --concurrent_downloads; > } > } > if (concurrent_downloads <= 0) { > return; > } > var startable_downloads = []; > for (var i = 0; i < UnPlug2Search._downloads.length; i++) { > if (UnPlug2Search._downloads[i] > && UnPlug2Search._downloads[i].download > && UnPlug2Search._downloads[i].download.is_started() == false) { > startable_downloads[startable_downloads.length] = i; > } > } > startable_downloads.sort(function (a, b) { > return UnPlug2Search._downloads[a].priority - UnPlug2Search._downloads[b].priority; > }); > for (var i = 0; i < startable_downloads.length && i < concurrent_downloads; ++i) { > var dl_id = startable_downloads[i]; > try { > UnPlug2Search._downloads[dl_id].download.start(); > UnPlug2.log("Starting download id = " + dl_id); > } catch (e) { > UnPlug2.log("Starting Download failed for " + dl_id + " / " + UnPlug2Search._downloads[dl_id].download + " because " + e); > UnPlug2Search._downloads[dl_id].download = null; > } 527a695 > UnPlug2Search._do_download_poll = true; 537a706 > UnPlug2Search._do_download_poll = true; 555a725 > UnPlug2Search._stopped = true; 559a730,749 > * Get a "hooks" item from rules.xml for adjusting eg download priority > * Returns an array > */ > get_hooks : function (hookname) { > if (UnPlug2Search._hooks === undefined) { > UnPlug2Search._hooks = {}; > var hooknodes = UnPlug2Search.get_rules_xml().getElementsByTagName("hook"); > for (var i = 0; i < hooknodes.length; ++i) { > var hooknode = hooknodes[i]; > var hookname = hooknode.getAttribute("for"); > if (UnPlug2Search._hooks[hookname] === undefined) { > UnPlug2Search._hooks[hookname] = []; > } > UnPlug2Search._hooks[hookname].push(hooknode); > } > } > return UnPlug2Search._hooks[hookname] || []; > }, > > /** 760c950 < if (!node.tagName) --- > if (!node.tagName) { 761a952,955 > } > if (node.tagName == "hook") { > continue; > } 950a1145,1146 > UnPlug2Search._do_download_poll = false; > window.setInterval(UnPlug2Search.poll, 100); diff --new-file --recursive --suppress-common-lines --exclude changes.txt --exclude diff.txt releases/unplug-2.027/source/install.rdf releases/unplug-2.028/source/install.rdf 6c6 < 2.027 --- > 2.028 Binary files releases/unplug-2.027/unplug.xpi and releases/unplug-2.028/unplug.xpi differ