diff --new-file --recursive --suppress-common-lines releases/unplug-1.901/source/chrome/content/common.js releases/unplug-1.902/source/chrome/content/common.js 94c94 < * return the string --- > * return a translated version of the string 100c100 < return "${" + name + "}"; --- > return "#{" + name + "}"; 139c139 < revision : 200908032205, --- > revision : 200903280009, diff --new-file --recursive --suppress-common-lines releases/unplug-1.901/source/chrome/content/config.js releases/unplug-1.902/source/chrome/content/config.js 76c76,81 < w.document.persist("nav-bar","currentset"); --- > if (navtoolbar.getAttribute("currentset")) { > navtoolbar.setAttribute("currentset", navtoolbar.getAttribute("currentset").replace(",unplug2_toolbarbutton", "")); > w.document.persist("nav-bar","currentset"); > } else { > alert("Persist failed"); > } 81c86,91 < w.document.persist("nav-bar","currentset"); --- > if (navtoolbar.currentSet) { > navtoolbar.setAttribute("currentset", navtoolbar.getAttribute("currentset") + ",unplug2_toolbarbutton"); > w.document.persist("nav-bar","currentset"); > } else { > alert("Persist failed"); > } diff --new-file --recursive --suppress-common-lines releases/unplug-1.901/source/chrome/content/overlay.js releases/unplug-1.902/source/chrome/content/overlay.js 32a33,34 > // TODO - don't use a flag, just use: > // window.removeEventListener("load", Flashblock.onInstall, true); 53c55,57 < for each (name in [ "toolsmenu", "contextmenu" ]) { --- > var menus = [ "toolsmenu", "contextmenu" ]; > for (var i = 0 ; i < menus.length; i++) { > var name = menus[i]; 63a68,69 > UnPlug2Overlay.load_flashblock_workaround(); > 69a76,99 > * Load flashblock workaround, if possible > */ > load_flashblock_workaround : function () { > // TODO - remove this! > return; > > // TODO - config option here! > //window.removeEventListener("load", Flashblock.onInstall, true); > > // check flashblock is installed > if (!window.Flashblock) > return; > > var sss = Components.classes["@mozilla.org/content/style-sheet-service;1"] > .getService(Components.interfaces.nsIStyleSheetService); > var ios = Components.classes["@mozilla.org/network/io-service;1"] > .getService(Components.interfaces.nsIIOService); > var u = ios.newURI("chrome://unplug/content/icantbelieveitsnotflashblock.css", null, null); > if (!sss.sheetRegistered(u, sss.USER_SHEET)) { > sss.loadAndRegisterSheet(u, sss.USER_SHEET); > } > }, > > /** diff --new-file --recursive --suppress-common-lines releases/unplug-1.901/source/chrome/content/rules.js releases/unplug-1.902/source/chrome/content/rules.js 282a283 > var elemlist = doc.getElementsByTagName(data.tagname); 385,389c386,387 < "protocol" : url.scheme } < // host is not always in nsiuri (it's probably in nsiurl or something): < try { < rtn.host = url.host; < } catch(e) {} --- > "protocol" : url.scheme, > "host" : url.host } 393a392,408 > /** > * When docs are not availaible, each_element calls this function > */ > _get_attrib_from_tagname_string : function (tag, attrib) { > // attrib="value" > // attrib='value' > // var m = RegExp("\\b" + attrib + "=([\"\'])([^\\1]+)", "i").exec(tag); -- TODO why didn;t this work? > var m = RegExp("\\b" + attrib + "=([\"\'])(.*?)\\1", "i").exec(tag); > if (m) > return m[2]; > // attrib=value > var m = RegExp("\\b" + attrib + "=([^\\s]+)", "i").exec(tag); > if (m) > return m[1]; > return null; > }, > 403c418,419 < "attrs"], --- > "attrs", > "slow"], 405a422 > var search_with_dom = true; 407c424,471 < throw "each_element requires a document"; --- > search_with_dom = false; > // TODO - this next line should be configurable for flashblock/no flashblock and for about:config settings too! > // TODO - and this is only really useful where we can get original source from cache > if ((data.tagname == "embed" || data.tagname == "object") && false) > search_with_dom = false; > if (!search_with_dom) { > UnPlug2.log("each_element works slowly when not given a document!"); > if (!data.tagname) > throw "each_element requires a document or a tagname"; > // "slow" tags, like searching all anchors, is skipped because this is likely to be significantly worse performance than using the dom. > if (data.slow) > return false; > var rtn = []; > var reg = RegExp("<" + data.tagname + "([^>]*)>", "gi"); > while (true) { > var regresult = reg.exec(text); > if (!regresult) > break; > var tag = regresult[1]; > var single_rtn = {}; > > var require_attrs = data.require_attrs.split(","); > if (require_attrs.indexOf("innerHTML") > -1) > throw "innerHTML not supported by without a doc."; > var got_all_req = true; > for (var i = 0; i < require_attrs.length; i++) { > var x = UnPlug2Rules._get_attrib_from_tagname_string(tag, require_attrs[i]); > if (!x) { > got_all_req = false; > break; > } > single_rtn[require_attrs[i]] = x; > } > if (!got_all_req) > continue > > var attrs = data.attrs.split(","); > for (var i = 0; i < attrs.length; i++) { > var x = UnPlug2Rules._get_attrib_from_tagname_string(tag, attrs[i]); > if (x) > single_rtn[attrs[i]] = x; > } > rtn[rtn.length] = single_rtn; > } > return rtn; > } > // above this line is the slow regexp version for no document > // below this line is the fast dom version for those with a document diff --new-file --recursive --suppress-common-lines releases/unplug-1.901/source/chrome/content/rules.xml releases/unplug-1.902/source/chrome/content/rules.xml 2c2 < --- > 6a7,12 > > > > > > 83,84c89,90 < < --- > > 116c122 < --- > 121c127 < --- > 126c132 < --- > 138,139c144,145 < < --- > > 153,190c159,243 < < < < < < < < < /googleplayer\.swf\?videoUrl=([^&]+)&thumbnailUrl=([^&]*) < < < < < < youtube\.com\/v\/([^&]+) < < < token=([^&]+)& < title=([^&]+)& < < < < < < vimeo\.com/moogaloop\.swf\?clip_id=(\d+)& < < < < < < --- > > > > > > > > > > > > > > > embed\.magnatune\.com.*playlist_url=([^&]+) > > > > <location>(.*?)</location> > <image>(.*?)</image> > <annotation>(.*?)</annotation> > > > > > > > > url="${qparam:mediaURL:embedelem.flashvars}?__gda__=${urlencode:qparam:gdaKey:embedelem.flashvars}" > description="${qparam:description:embedelem.flashvars}" > thumbnail="${qparam:staticURL:embedelem.flashvars}/thumb/${qparam:itemID:embedelem.flashvars}.jpg" > /> > > > > /googleplayer\.swf\?videoUrl=([^&]+)&thumbnailUrl=([^&]*) > > > > > > youtube\.com\/v\/([^&]+) > > > token=([^&]+)& > title=([^&]+)& > > > > > > vimeo\.com/moogaloop\.swf\?clip_id=(\d+)& > > > > > > > > > \.flv(?:\?|$) > > > > > > > 193,194c246 < < --- > (?:filename|url) 209a262,272 > > > > /video(\d+)/ > > > > > > > 288a352,394 > > > > /(\d+) > > > > > > > > > > > > > &amp;flv_url=(.*?)&amp; > &amp;url_bigthumb=(.*?)&amp; > > > > > > > > (http.*?\.flv) > > > > > > > > > > > > > > > > > diff --new-file --recursive --suppress-common-lines releases/unplug-1.901/source/chrome/content/search.js releases/unplug-1.902/source/chrome/content/search.js 65c65 < this._xmlhttp.send(post_data); --- > this._xmlhttp.send(null); 236a237 > // parts here is in REVERSE ORDER 247c248 < var funcname = parts.pop(); --- > var funcname = parts.pop() 248a250,252 > /** > * Decodes url %nn escape codes in variable > */ 250a255,278 > /** > * Encodes url %nn escape codes in variable > */ > case "urlencode": > return escape(this._subst_apply_functions(parts)); > /** > * decode html entities TODO > */ > case "htmldecode": > return this._subst_apply_functions(parts).replace("&", "&"); > /** > * ${random:float} > */ > case "random": > if (parts.length != 1) > throw "Cannot parse ${random:...}"; > switch (parts[0]) { > case "float": > return Math.random(); > } > throw "Unknown ${random:...} " + parts[0]; > /** > * ${optional:varname} > */ 256a285,352 > /** > * ${translate:name_in_locale_file} > */ > case "translate": > if (parts.length != 1) > throw "Invalid length for ${translate:...}"; > return UnPlug2.str(parts[0]); > /* > * ${substring:start:variablename} > * ${substring:start:end:variablename} > * can be -ve numbers (like python) > */ > case "substring": > var fullstring = this._subst_apply_functions(parts); > var n1 = Number(parts[parts.length-1]); > if (n1 < 0) > n1 += fullstring.length; > var n2 = Number(parts[parts.length-2]); > parts.pop(); // pop n1 > if (n2 === NaN) { > if (n2 < 0) > n2 += fullstring.length; > return String(fullstring).substring(n1); > } > parts.pop(); // pop n2 too > return String(fullstring).substring(n1); > case "reversed": > var value = this._subst_apply_functions(parts); > return value.split("").reverse().join("") > /** > * ${padprefix:pad_char:boundary_size:variable} > * Pads variabe with pad_char until length divisible by boundary_size. > */ > case "padprefix": > var prefixvalue = parts.pop() > var prefixboundary = Number(parts.pop()) > var value = this._subst_apply_functions(parts); > if (prefixvalue.length != 1) > throw "char must be length 1 in ${padprefix}"; > if (!prefixboundary) > throw "Invalid boundary size in ${padprefix}"; > while (value.length % prefixboundary) > value = prefixvalue + value; > return value; > /** > * ${hextostr:varname} > */ > case "hextostr": > var hex = this._subst_apply_functions(parts); > if (hex.length % 2) { > hex = "0" + hex; > } > var twohexes = Array(); > for (var i = 0; i < hex.length; i+= 2) { > twohexes[twohexes.length] = hex.substring(i, i+2); > } > return twohexes.map(function (x) { return String.fromCharCode(Number("0x" + x)); }).join(""); > /** > * ${qparam:paramname:urlvarname} > */ > case "qparam": > var qname = parts.pop(); > var urlstring = this._subst_apply_functions(parts); > urlstring = urlstring.substring(urlstring.indexOf("?")+1); > urlstring = "&" + urlstring + "&"; > var r = RegExp("&" + qname + "=([^&]+)"); > var m = r.exec(urlstring); > return unescape(m[1]); 512,513c608,609 < for (var i = 0; i < window.frames.length; i++) { < UnPlug2Search._apply_rules_to_window(window.frames[i], rules_xml, variables); --- > for (var i = 0; i < win.frames.length; i++) { > UnPlug2Search._apply_rules_to_window(win.frames[i], rules_xml, variables); 532c628,633 < return --- > return; > > if (["http", "https"].indexOf(url.scheme) < 0) { > UnPlug2.log("Invalid url for search " + url.spec); > return; > } diff --new-file --recursive --suppress-common-lines releases/unplug-1.901/source/chrome/content/searchpage.js releases/unplug-1.902/source/chrome/content/searchpage.js 141a142,153 > > var duplicate_elem = reselem.checkDuplicates(reselem.parentNode); > if (duplicate_elem) { > UnPlug2.log("Duplicate element"); > if (!UnPlug2.get_pref("show_duplicates", false)) { > var things_to_copy = ["thumbnail", "description"]; > for (var j=0; j < things_to_copy.length; j++) { > duplicate_elem.setAttribute(things_to_copy[j], duplicate_elem.getAttribute(things_to_copy[j]) || reselem.getAttribute(things_to_copy[j])); > } > reselem.parentNode.removeChild(reselem); > } > } diff --new-file --recursive --suppress-common-lines releases/unplug-1.901/source/chrome/content/widgets/unplug_result.xbl releases/unplug-1.902/source/chrome/content/widgets/unplug_result.xbl 93a94,111 > > > > var thiselem = this; > var reslist = p.getElementsByTagName("unplug_result"); > for (var i=0; i < reslist.length; i++) { > var elem = reslist[i]; > if (elem === thiselem) { > continue; > } > if (elem.getAttribute("url") == thiselem.getAttribute("url") && elem.getAttribute("post") == thiselem.getAttribute("post")) { > // this is a duplicate: remove thiselem > return elem; > } > } > return false; > > diff --new-file --recursive --suppress-common-lines releases/unplug-1.901/source/chrome/locale/en-US/config.dtd releases/unplug-1.902/source/chrome/locale/en-US/config.dtd 47c47 < --- > 49,50c49,50 < < --- > > 60c60 < --- > diff --new-file --recursive --suppress-common-lines releases/unplug-1.901/source/chrome/locale/en-US/rules.dtd releases/unplug-1.902/source/chrome/locale/en-US/rules.dtd 1,13d0 < < < < < < < diff --new-file --recursive --suppress-common-lines releases/unplug-1.901/source/chrome/locale/en-US/strings.txt releases/unplug-1.902/source/chrome/locale/en-US/strings.txt 16a17,21 > # for rules.xml > high_quality=High quality > low_quality=Low quality > mid_quality=Normal quality > hd_quality=High definition diff --new-file --recursive --suppress-common-lines releases/unplug-1.901/source/install.rdf releases/unplug-1.902/source/install.rdf 19,20c19,20 < UnPlug 2.0 Alpha < UnPlug 2.0 Developers' version --- > UnPlug > Find and download media from websites diff --new-file --recursive --suppress-common-lines releases/unplug-1.901/source/todo.txt releases/unplug-1.902/source/todo.txt 4,7c4 < Fix pop_contest db -- add date to PK. Fix navigator.useragent. < < Migration-assistant - add to welcome tab in config < (this should probably be moved to 2.1 because no media player integration, etc) --- > More websites! More! 11c8,9 < Fill in .type from filename extension (if none was given) in UnPlug2Search and display/use this hint in UnPlug2SearchPage --- > Tell people when menu config is applied next restart. > 13a12,13 > // flashblock
s have .getAttribute("srcAttribute") for .src > document.getElementsByTagName("div")[0].getAttribute("srcAttribute") 15c15,19 < More finely-grained optional/required attributes in UnPlug2Rules -- eg Flashblock workaround > If we want to use flashblock workabout and flash has been blocked, then... > * Get original source from somewhere - load from cache with BrowserReloadWithFlags(reloadFlags) or PageLoader.loadPage() ?? > * Set text representation to this (note - this loses dynamic changes we pick up with the dom serializer object) > * Feed it to the slow version of each_element 17d20 < handle exotic types in (mms://, rtsp://, ...) 19d21 < Implement s for lots of sites. 21c23,24 < Rules documentation --- > For UnPlug 2.05 ["Clinic"] > ========================= 23c26 < Tell people that menu config is applied next restart. --- > More finely-grained optional/required attributes in UnPlug2Rules -- eg Rules documentation 33a38,41 > Migration-assistant - copy media player config, then UnPlug._prefs.resetBranch(old_settings_base)! > > handle exotic types in (mms://, rtsp://, ...) > 38c46,47 < , + binary downloads --- > Fill in .type from filename extension (if none was given) in UnPlug2Search and display/use this hint in UnPlug2SearchPage > 39a49,52 > For UnPlug 2.2 ["Sprawl"] > ========================= > > , + binary downloads diff --new-file --recursive --suppress-common-lines releases/unplug-1.901/source/todo.txt~ releases/unplug-1.902/source/todo.txt~ 0a1,44 > For UnPlug 2.0 ["Chiba"] > ======================== > > Implement flashblock workaround -- perhaps ? > // flashblock
s have .getAttribute("srcAttribute") for .src > document.getElementsByTagName("div")[0].getAttribute("srcAttribute") > > Implement some sort of each_element for .text, not just .doc > This gives us a different flashblock workaround: re-downloading ${.url} > > Add icon on stop button > > More finely-grained optional/required attributes in UnPlug2Rules -- eg > Rules documentation > > Tell people when menu config is applied next restart. > > > > For UnPlug 2.1 ["Tokyo"] > ======================== > > Non-en-US locales > > Add ability > > Migration-assistant - copy media player config, then UnPlug._prefs.resetBranch(old_settings_base)! > > > handle exotic types in (mms://, rtsp://, ...) > > Implement (media) players, with "search for media players" config > > Write your own rules more easily > > Fill in .type from filename extension (if none was given) in UnPlug2Search and display/use this hint in UnPlug2SearchPage > > > For UnPlug 2.2 ["Sprawl"] > ========================= > > , + binary downloads > diff --new-file --recursive --suppress-common-lines releases/unplug-1.901/source/update.txt releases/unplug-1.902/source/update.txt 1,6d0 < < update path is < * open update popup < * migrate prefs < * UnPlug._prefs.resetBranch(_settings_base) !! < Binary files releases/unplug-1.901/unplug.xpi and releases/unplug-1.902/unplug.xpi differ