Changeset 731 for branches/maierman
- Timestamp:
- 2008-01-12 15:10:07 (1 year ago)
- Files:
-
- branches/maierman/searching/chrome.manifest (modified) (3 diffs)
- branches/maierman/searching/chrome/content/about/about.xul (modified) (5 diffs)
- branches/maierman/searching/chrome/content/common/bindings.xml (modified) (3 diffs)
- branches/maierman/searching/chrome/content/common/internalFunctions.js (modified) (17 diffs)
- branches/maierman/searching/chrome/content/common/overlayFunctions.js (modified) (8 diffs)
- branches/maierman/searching/chrome/content/dta/addurl.js (modified) (14 diffs)
- branches/maierman/searching/chrome/content/dta/addurl.xul (modified) (2 diffs)
- branches/maierman/searching/chrome/content/dta/manager.js (modified) (71 diffs)
- branches/maierman/searching/chrome/content/dta/manager.xul (modified) (5 diffs)
- branches/maierman/searching/chrome/content/dta/manager/alertservice.js (modified) (3 diffs)
- branches/maierman/searching/chrome/content/dta/manager/customevent.js (modified) (2 diffs)
- branches/maierman/searching/chrome/content/dta/manager/decompressor.js (modified) (3 diffs)
- branches/maierman/searching/chrome/content/dta/manager/info.xul (modified) (1 diff)
- branches/maierman/searching/chrome/content/dta/manager/metalinker.js (modified) (9 diffs)
- branches/maierman/searching/chrome/content/dta/manager/metaselect.xul (modified) (2 diffs)
- branches/maierman/searching/chrome/content/dta/manager/prefs.js (modified) (4 diffs)
- branches/maierman/searching/chrome/content/dta/manager/sessionmanager.js (modified) (17 diffs)
- branches/maierman/searching/chrome/content/dta/manager/tooltip.js (modified) (11 diffs)
- branches/maierman/searching/chrome/content/dta/manager/tooltip.xul (modified) (3 diffs)
- branches/maierman/searching/chrome/content/dta/manager/tree.js (modified) (13 diffs)
- branches/maierman/searching/chrome/content/dta/manager/verificator.js (modified) (2 diffs)
- branches/maierman/searching/chrome/content/dta/maskbutton.js (modified) (1 diff)
- branches/maierman/searching/chrome/content/dta/renamingmask.xul (modified) (2 diffs)
- branches/maierman/searching/chrome/content/dta/select.xul (modified) (3 diffs)
- branches/maierman/searching/chrome/content/integration/elements.js (modified) (14 diffs)
- branches/maierman/searching/chrome/content/integration/elements.xul (modified) (3 diffs)
- branches/maierman/searching/chrome/content/integration/firefox.xul (modified) (1 diff)
- branches/maierman/searching/chrome/content/integration/saveas.js (modified) (6 diffs)
- branches/maierman/searching/chrome/content/integration/saveas.xul (modified) (1 diff)
- branches/maierman/searching/chrome/content/integration/seamonkey.js (deleted)
- branches/maierman/searching/chrome/content/integration/seamonkey.xul (modified) (1 diff)
- branches/maierman/searching/chrome/content/integration/songbird.xul (copied) (copied from trunk/chrome/content/integration/songbird.xul)
- branches/maierman/searching/chrome/content/integration/thunderbird.xul (modified) (1 diff)
- branches/maierman/searching/chrome/content/integration/toolbarButtons.js (copied) (copied from trunk/chrome/content/integration/toolbarButtons.js)
- branches/maierman/searching/chrome/content/preferences/interfacePane.xul (modified) (2 diffs)
- branches/maierman/searching/chrome/content/preferences/prefs.js (modified) (3 diffs)
- branches/maierman/searching/chrome/content/preferences/seamonkey.xul (deleted)
- branches/maierman/searching/chrome/content/preferences/toolbarButtons.xul (copied) (copied from trunk/chrome/content/preferences/toolbarButtons.xul)
- branches/maierman/searching/chrome/help/faq.html (modified) (1 diff)
- branches/maierman/searching/chrome/help/preferences.html (modified) (2 diffs)
- branches/maierman/searching/chrome/locale/en-US/about.dtd (modified) (1 diff)
- branches/maierman/searching/chrome/locale/en-US/addurl.properties (modified) (1 diff)
- branches/maierman/searching/chrome/locale/en-US/common.dtd (modified) (2 diffs)
- branches/maierman/searching/chrome/locale/en-US/manager.dtd (modified) (1 diff)
- branches/maierman/searching/chrome/locale/en-US/manager.properties (modified) (1 diff)
- branches/maierman/searching/chrome/locale/en-US/menu.properties (modified) (1 diff)
- branches/maierman/searching/chrome/locale/en-US/prefpanes.dtd (modified) (4 diffs)
- branches/maierman/searching/chrome/locale/en-US/select.dtd (modified) (1 diff)
- branches/maierman/searching/chrome/skin/common/logo-rtl.png (copied) (copied from trunk/chrome/skin/common/logo-rtl.png)
- branches/maierman/searching/chrome/skin/common/selectnone.png (copied) (copied from trunk/chrome/skin/common/selectnone.png)
- branches/maierman/searching/chrome/skin/common/songbird.css (copied) (copied from trunk/chrome/skin/common/songbird.css)
- branches/maierman/searching/chrome/skin/common/style.css (modified) (4 diffs)
- branches/maierman/searching/chrome/skin/manager/bardonate-hover-ltr.png (copied) (copied from trunk/chrome/skin/manager/bardonate-hover-ltr.png)
- branches/maierman/searching/chrome/skin/manager/bardonate-hover-rtl.png (copied) (copied from trunk/chrome/skin/manager/bardonate-hover-rtl.png)
- branches/maierman/searching/chrome/skin/manager/bardonate-ltr.png (copied) (copied from trunk/chrome/skin/manager/bardonate-ltr.png)
- branches/maierman/searching/chrome/skin/manager/bardonate-rtl.png (copied) (copied from trunk/chrome/skin/manager/bardonate-rtl.png)
- branches/maierman/searching/chrome/skin/manager/bardonate.png (deleted)
- branches/maierman/searching/chrome/skin/manager/bardonateactive.png (deleted)
- branches/maierman/searching/chrome/skin/manager/bardonatehover.png (deleted)
- branches/maierman/searching/chrome/skin/manager/info.css (modified) (1 diff)
- branches/maierman/searching/chrome/skin/manager/paused-undetermined.png (copied) (copied from trunk/chrome/skin/manager/paused-undetermined.png)
- branches/maierman/searching/chrome/skin/manager/style.css (modified) (4 diffs)
- branches/maierman/searching/chrome/skin/manager/undetermined.gif (copied) (copied from trunk/chrome/skin/manager/undetermined.gif)
- branches/maierman/searching/chrome/skin/select/style.css (modified) (1 diff)
- branches/maierman/searching/install.rdf (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/maierman/searching/chrome.manifest
r568 r731 19 19 style chrome://global/content/customizeToolbar.xul chrome://dta/skin/integration/style.css 20 20 21 ## toolkit ## 22 overlay chrome://mozapps/content/downloads/unknownContentType.xul chrome://dta/content/integration/saveas.xul 23 21 24 ## Firefox / Flock ## 22 25 overlay chrome://browser/content/browser.xul chrome://dta/content/integration/firefox.xul … … 28 31 overlay chrome://browser/content/sanitize.xul chrome://dta/content/privacy/overlaySanitizeUI.xul 29 32 overlay chrome://browser/content/sanitize.xul chrome://dta/content/privacy/overlaySanitizeCode.xul 30 overlay chrome:///content/downloads/unknownContentType.xul chrome://dta/content/integration/saveas.xul31 33 32 34 ## Seamonkey ## 33 35 overlay chrome://navigator/content/navigator.xul chrome://dta/content/integration/seamonkey.xul application={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} 34 36 overlay chrome://dta/content/integration/seamonkey.xul chrome://dta/content/integration/elements.xul application={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} 35 overlay chrome://dta/content/preferences/interfacePane.xul chrome://dta/content/preferences/ seamonkey.xul application={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}37 overlay chrome://dta/content/preferences/interfacePane.xul chrome://dta/content/preferences/toolbarButtons.xul application={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} 36 38 style chrome://navigator/content/navigator.xul chrome://dta/skin/integration/style.css application={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} 37 39 … … 43 45 style chrome://messenger/content/messageWindow.xul chrome://dta/skin/integration/style.css application={3550f703-e582-4d05-9a08-453d09bdfdc6} 44 46 45 ## toolkit ## 46 overlay chrome://mozapps/content/downloads/unknownContentType.xul chrome://dta/content/integration/saveas.xul 47 ## Songbird ## 48 overlay chrome://songbird/content/xul/mainScriptsOverlay.xul chrome://dta/content/integration/songbird.xul application=songbird@songbirdnest.com 49 overlay chrome://dta/content/integration/songbird.xul chrome://dta/content/integration/elements.xul application=songbird@songbirdnest.com 50 style chrome://songbird/content/xul/mainScriptsOverlay.xul chrome://dta/skin/integration/style.css application=songbird@songbirdnest.com 51 style chrome://dta/content/dta/manager.xul chrome://dta/skin/common/songbird.css application=songbird@songbirdnest.com 52 style chrome://dta/content/dta/select.xul chrome://dta/skin/common/songbird.css application=songbird@songbirdnest.com 53 overlay chrome://dta/content/preferences/interfacePane.xul chrome://dta/content/preferences/toolbarButtons.xul application=songbird@songbirdnest.com branches/maierman/searching/chrome/content/about/about.xul
r577 r731 1 1 <?xml version="1.0"?> 2 <!DOCTYPE dialog [ 3 <!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd"> 4 %globalDTD; 5 <!ENTITY % aboutDTD 6 SYSTEM "chrome://dta/locale/about.dtd"> 7 %aboutDTD; 8 <!ENTITY % htmlDTD 9 PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 10 %htmlDTD; 11 ]> 2 12 <!-- 3 13 /* ***** BEGIN LICENSE BLOCK ***** … … 21 31 * 22 32 * Contributor(s): 23 * Federico Parodi 33 * Federico Parodi <f.parodi@tiscali.it> 24 34 * Stefano Verna <stefano.verna@gmail.com> 25 35 * Nils Maier <MaierMan@web.de> … … 45 55 <?xml-stylesheet href="chrome://dta-platform/skin/common.css" type="text/css"?> 46 56 47 <!DOCTYPE window SYSTEM "chrome://dta/locale/about.dtd">48 57 <dialog 49 58 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" … … 75 84 </keyset> 76 85 77 <dialogheader id="logo" title="DownThemAll!" description="&about.subtitle;" orient="vertical" style="font-size: smaller;" />86 <dialogheader id="logo" title="DownThemAll!" description="&about.subtitle;" orient="vertical" style="font-size: smaller;" chromedir="&locale.dir;"/> 78 87 <groupbox orient="vertical"> 79 88 <label value="Copyright © 2004-2007 By:" style="font-weight: bold;"/> … … 86 95 <separator class="thin"/> 87 96 <description> 88 <html:b>&about.icons;</html:b>& about.based;97 <html:b>&about.icons;</html:b> &about.based; 89 98 <html:ul> 90 99 <html:li>© Michael Matas</html:li> 91 100 <html:li>© <html:span class="link" onclick="openTab('http://jimmac.musichall.cz/icons.php');">Jakub 'jimmac' Steiner</html:span>; © Novell, Inc.</html:li> 92 101 <html:li>© <html:span class="link" onclick="openTab('http://www.famfamfam.com/lab/icons/silk/');">Mark James</html:span> (famfamfam silk icons)</html:li> 102 <html:li>© The mozilla contributors</html:li> 93 103 </html:ul> 94 104 </description> branches/maierman/searching/chrome/content/common/bindings.xml
r598 r731 61 61 </setter> 62 62 </property> 63 <property name="shouldResize"> 64 <getter> 65 return this.getAttribute('shouldResize') == 'true'; 66 </getter> 67 <setter> 68 this.setAttribute('shouldResize', val ? 'true' : 'false'); 69 </setter> 70 </property> 63 71 <property name="accessibleType" readonly="true"> 64 72 <getter> … … 74 82 <handler event="click"> 75 83 this.parentNode.closed = !this.parentNode.closed; 84 if (this.parentNode.shouldResize) { 85 window.sizeToContent(); 86 } 76 87 </handler> 77 88 </handlers> … … 241 252 <field name="_additionalLinks">document.getAnonymousElementByAttribute(this, 'anonid', 'additionallinks');</field> 242 253 <field name="_desc">document.getAnonymousElementByAttribute(this, 'anonid', 'desc');</field> 243 <property name="checked" onget="return this._checkbox.checked;" />254 <property name="checked" onget="return this._checkbox.checked;" onset="this._checkbox.checked = !!val; return !!val;"/> 244 255 </implementation> 245 256 </binding> branches/maierman/searching/chrome/content/common/internalFunctions.js
r592 r731 20 20 * 21 21 * Contributor(s): 22 * Federico Parodi 22 * Federico Parodi <f.parodi@tiscali.it> 23 23 * Stefano Verna <stefano.verna@gmail.com> 24 24 * Nils Maier <MaierMan@web.de> … … 43 43 var Preferences = DTA_preferences; 44 44 45 const IOService = Components.classes["@mozilla.org/network/io-service;1"] 46 .getService(Components.interfaces.nsIIOService); 47 48 const FileFactory = new Components.Constructor( 49 '@mozilla.org/file/local;1', 50 'nsILocalFile', 51 'initWithPath' 52 ); 53 54 const SoundFactory = new Components.Constructor( 55 '@mozilla.org/sound;1', 56 'nsISound', 57 'play' 58 ); 59 60 45 61 const SYSTEMSLASH = (DTA_profileFile.get('dummy').path.indexOf('/') != -1) ? '/' : '\\'; 46 62 … … 83 99 return document.getElementById(arguments[0]); 84 100 } 85 var elements = []; 86 for (var i = 0, e = arguments.length; i < e; ++i) { 87 var id = arguments[i]; 88 var element = document.getElementById(id); 101 let elements = []; 102 for (let i = 0, e = arguments.length; i < e; ++i) { 103 let element = document.getElementById(arguments[i]); 89 104 if (element) { 90 105 elements.push(element); … … 103 118 } 104 119 105 // not instanceof save, you know ;)120 // not instanceof save, you know ;) 106 121 function clone(obj) { 107 { 108 var rv = {}; 109 merge(rv, obj); 110 rv.prototype = this.prototype; 111 rv.constructor = this.constructor; 112 return rv; 113 } 122 var rv = {}; 123 merge(rv, obj); 124 rv.prototype = this.prototype; 125 rv.constructor = this.constructor; 126 return rv; 114 127 } 115 128 merge( … … 162 175 }, 163 176 getUsableFileName : function() { 164 let t = this.replace(/ [#?].*$/g, '')177 let t = this.replace(/\?.*$/, '') 165 178 .normalizeSlashes() 166 179 .trim() … … 182 195 } 183 196 return this; 197 }, 198 toURI: function(charset, baseURI) { 199 return IOService.newURI(this, charset, baseURI); 200 }, 201 toURL: function(charset, baseURI) { 202 return this.toURI(charset, baseURI).QueryInterface(Components.interfaces.nsIURL); 184 203 } 185 204 } … … 193 212 * @return A string containing the user selected path, or false if user cancels the dialog. 194 213 */ 214 FilePicker: Components.Constructor('@mozilla.org/filepicker;1', 'nsIFilePicker', 'init'), 195 215 askForDir: function (predefined, text) { 196 216 try { 197 217 // nsIFilePicker object 198 218 var nsIFilePicker = Components.interfaces.nsIFilePicker; 199 var fp = Components.classes['@mozilla.org/filepicker;1'].createInstance(nsIFilePicker); 200 fp.init(window, text, nsIFilePicker.modeGetFolder); 219 var fp = new Utils.FilePicker(window, text, nsIFilePicker.modeGetFolder); 201 220 fp.appendFilters(nsIFilePicker.filterAll); 202 221 … … 225 244 */ 226 245 validateDir: function(path) { 227 vardirectory = null;246 let directory = null; 228 247 if (!(path instanceof Components.interfaces.nsILocalFile)) { 229 248 if (!path || !String(path).trim().length) { 230 249 return false; 231 250 } 232 var directory = Components.classes["@mozilla.org/file/local;1"]. 233 createInstance(Components.interfaces.nsILocalFile); 234 try { 235 directory.initWithPath(path); 236 } 237 catch (ex) { 238 // 239 } 251 directory = new FileFactory(path); 240 252 } 241 253 else { 242 254 directory = path.clone(); 243 255 } 244 if (directory) { 245 try { 246 // look for the first directory that exists. 247 var parent = directory.clone(); 248 while (parent && !parent.exists()) { 249 parent = parent.parent; 250 } 251 if (parent) { 252 // from nsIFile 253 parent = parent.QueryInterface(Components.interfaces.nsILocalFile); 254 // we look for a directory that is writeable and has some diskspace 255 return parent.isDirectory() && parent.isWritable() && parent.diskSpaceAvailable ? directory : false; 256 } 257 } 258 catch(ex) { 259 Debug.dump('Utils.validateDir()', ex); 260 } 256 if (!directory) { 257 return false; 258 } 259 try { 260 // look for the first directory that exists. 261 let parent = directory.clone(); 262 while (parent && !parent.exists()) { 263 parent = parent.parent; 264 } 265 if (parent) { 266 // from nsIFile 267 parent = parent.QueryInterface(Components.interfaces.nsILocalFile); 268 // we look for a directory that is writable and has some disk-space 269 return parent.isDirectory() && parent.isWritable() && parent.diskSpaceAvailable ? directory : false; 270 } 271 } 272 catch(ex) { 273 Debug.dump('Utils.validateDir()', ex); 261 274 } 262 275 return false; … … 266 279 * Here, because diskSpaceAvailable requires valid path and/or path to be a directory 267 280 * @param file Valid nsILocalFile 268 * @return the disk space available to the caller281 * @return the disk-space available to the caller 269 282 * @author Nils 270 283 */ … … 280 293 /** 281 294 * Play a sound file (if prefs allow to do so) 282 * @param name Name of the sound (corre psonding to the pref name and the file name of desired sound)295 * @param name Name of the sound (corresponding to the pref name and the file name of desired sound) 283 296 */ 284 297 playSound: function(name) { 285 298 try { 286 299 if (Preferences.getDTA("sounds." + name, false)) { 287 var sound = Components.classes["@mozilla.org/sound;1"] 288 .createInstance(Ci.nsISound); 289 var uri = Cc['@mozilla.org/network/standard-url;1'] 290 .createInstance(Ci.nsIURI); 291 uri.spec = "chrome://dta/skin/sounds/" + name + ".wav"; 292 sound.play(uri); 300 new SoundFactory(("chrome://dta/skin/sounds/" + name + ".wav").toURI()); 293 301 } 294 302 } … … 379 387 }; 380 388 381 var _getIcon = function() { 382 if (navigator.platform.search(/mac/i) != -1) { 383 const _getIcon_recognizedMac = /\.(?:gz|zip|gif|jpe?g|jpe|mp3|pdf|avi|mpe?g)$/i; 389 const _getIcon_recognizedMac = /\.(?:gz|zip|gif|jpe?g|jpe|mp3|pdf|avi|mpe?g)$/i; 390 391 function _getIcon() { 392 if (/mac/i.test(navigator.platform)) { 384 393 return function (url, size) { 385 var uri = Components.classes["@mozilla.org/network/standard-url;1"] 386 .createInstance(Components.interfaces.nsIURI); 387 uri.spec = url; 388 if (uri.path.search(_getIcon_recognizedMac) != -1) { 394 let uri = url.toURI(); 395 if (_getIcon_recognizedMac.test(uri.path)) { 389 396 return "moz-icon://" + url + "?size=" + size; 390 397 } … … 496 503 497 504 /** 498 * Constructor helper for nsILocalFile499 */500 const FileFactory = new Components.Constructor(501 "@mozilla.org/file/local;1",502 "nsILocalFile",503 "initWithPath"504 );505 506 /**507 505 * XP compatible reveal/launch 508 506 * @author Nils (derived from DownloadManager code) 509 507 */ 510 508 var OpenExternal = { 511 _io: Components.classes['@mozilla.org/network/io-service;1']512 .getService(Components.interfaces.nsIIOService),513 509 _proto: Components.classes['@mozilla.org/uriloader/external-protocol-service;1'] 514 510 .getService(Components.interfaces.nsIExternalProtocolService), 515 511 _prepare: function(file) { 512 if (typeof(file) == 'string' || file instanceof String) { 513 return new FileFactory(file); 514 } 515 if (file instanceof Components.interfaces.nsIFile) { 516 return file.QueryInterface(Components.interfaces.nsILocalFile); 517 } 516 518 if (file instanceof Components.interfaces.nsILocalFile) { 517 519 return file; 518 520 } 519 else if (typeof(file) == 'string') {520 return new FileFactory(file);521 }522 521 throw new Components.Exception('OpenExternal: feed me with nsILocalFile or String'); 523 522 }, 524 523 _nixLaunch: function(file) { 525 this._proto.loadUrl( this._io.newFileURI(file));524 this._proto.loadUrl(IOService.newFileURI(file)); 526 525 }, 527 526 /** … … 531 530 launch: function(file) { 532 531 file = this._prepare(file); 532 if (!file.exists()) { 533 throw new Components.Exception("OpenExternal: file not found!"); 534 } 535 533 536 try { 534 537 file.launch(); … … 545 548 reveal: function(file) { 546 549 file = this._prepare(file); 547 548 550 try { 549 551 if (!file.exists()) { 550 file.parent.QueryInterface(Components.interfaces.nsILocalFile).launch();552 throw new Components.Exception("File does not exist"); 551 553 } 552 554 else { … … 555 557 } 556 558 catch (ex) { 557 if (file.parent.exists()) { 558 this._nixLaunch(file.parent); 559 } 559 // try to open the directory instead 560 // (either because the file does not exist anymore 561 // or because the platform does not implement reveal); 562 this.launch(file.parent); 560 563 } 561 564 } … … 563 566 564 567 /** 565 * Range generator (python style). Difference: step direction is ini alized accordingly if corresponding parameter is omitted.568 * Range generator (python style). Difference: step direction is initialized accordingly if corresponding parameter is omitted. 566 569 * @param start Optional. Start value (default: 0) 567 570 * @param stop Stop value (exclusive) … … 591 594 return; 592 595 } 593 stop += (stop - start) % step; 594 for (;start != stop; start += step) { 596 stop += -Math.abs(step)/step; 597 stop += step - ((stop - start) % step); 598 for (; start != stop; start += step) { 595 599 yield start; 596 600 } 601 597 602 } 598 603 branches/maierman/searching/chrome/content/common/overlayFunctions.js
r576 r731 20 20 * Contributor(s): 21 21 * Nils Maier <MaierMan@web.de> 22 * Federico Parodi 22 * Federico Parodi <f.parodi@tiscali.it> 23 23 * Stefano Verna <stefano.verna@gmail.com> 24 24 * … … 220 220 } 221 221 if (e instanceof Components.Exception) { 222 if (!e.message) 223 text += e; 224 else 225 text += e.message + " (nsResult=" + e.result + ")"; 222 text += e.toString(); 226 223 } else if (e instanceof Error) { 227 224 if (!e.message) … … 292 289 function DTA_URL(url, charset, usable, preference) { 293 290 this.charset = this.str(charset); 294 this.usable = this.str(usable); 295 this._url = this.str(url); 291 this.url = url; 292 if (usable) { 293 this.usable = this.str(usable); 294 } 296 295 this.preference = preference ? preference : 100; 297 296 … … 307 306 }, 308 307 set url(nv) { 308 delete this.hash; 309 309 this._url = this.str(nv); 310 var hash = DTA_getLinkPrintHash(this._url); 311 if (hash) { 312 this.hash = hash; 313 } 314 this._url = this._url.replace(/#.*$/, ''); 310 315 this.usable = ''; 311 316 this.decode(); 312 317 }, 313 318 decode: function DU_decode() { 314 if (!this.usable .length)319 if (!this.usable) 315 320 { 316 321 this.usable = DTA_URLhelpers.decodeCharset(this._url, this.charset); … … 345 350 } 346 351 var doc = document.commandDispatcher.focusedWindow.document; 347 url = new DTA_URL(url, doc.characterSet); 352 353 var ml = DTA_getLinkPrintMetalink(url); 354 url = new DTA_URL(ml ? ml : url, doc.characterSet); 355 348 356 var ref = DTA_AddingFunctions.getRef(doc); 349 357 this.func(url, ref); … … 444 452 445 453 saveSingleLink : function(turbo, url, referrer, description) { 446 var hash = null;447 var ml = DTA_getLinkPrintMetalink(url.url);448 if (ml) {449 url.url = ml;450 }451 else {452 hash = DTA_getLinkPrintHash(url.url);453 }454 url.url = url.url.replace(/#.*$/, '');455 456 454 var item = { 457 455 'url': url, 458 456 'referrer': referrer, 459 'description': description, 460 'hash': hash 457 'description': description 461 458 }; 462 459 … … 709 706 'MD5': 32, 710 707 'SHA1': 40, 711 'SHA256': 64 712 /* Currently broken: https://bugzilla.mozilla.org/show_bug.cgi?id=383390 713 'sha384': 96, 714 'sha512': 128 */ 708 'SHA256': 64, 709 'SHA384': 96, 710 'SHA512': 128 715 711 }; 716 712 function DTA_Hash(hash, type) { … … 732 728 } 733 729 } 730 DTA_Hash.prototype = { 731 toString: function() { 732 return this.type + " [" + this.sum + "]"; 733 } 734 }; 734 735 735 736 /** branches/maierman/searching/chrome/content/dta/addurl.js
r594 r731 51 51 this.mask = Dialog.ddRenaming.value; 52 52 this.dirSave = Dialog.ddDirectory.value; 53 this.hash = hash; 53 if (hash) { 54 this.url.hash = hash; 55 } 54 56 } 55 57 56 58 function Literal(str) { 57 59 this.str = str; 60 this.first = this.last = this.str; 58 61 this.length = 1; 59 62 } … … 66 69 } 67 70 }; 68 function NumericRange(name, start, stop, step, strl) { 69 this.name = name; 70 this.start = start; 71 this.stop = stop + (start > stop ? -1 : 1); 72 this.step = step; 73 this.length = Math.floor((stop - start) / step + 1); 74 this.strl = strl; 75 }; 76 NumericRange.prototype = { 77 _format: function(i) { 78 var rv = String(Math.abs(i)); 79 while (rv.length < this.strl) { 80 rv = '0' + rv; 81 } 82 if (i < 0) { 83 rv = '-' + rv; 84 } 85 return rv; 71 72 function Range() { 73 }; 74 Range.prototype = { 75 init: function(name, start, stop, step) { 76 stop += -Math.abs(step)/step; 77 stop += step - ((stop - start) % step); 78 79 this.name = name; 80 this.start = start; 81 this.stop = stop; 82 this.step = step; 83 this.length = Math.floor((stop - start) / step); 84 this.first = this._format(this.start); 85 this.last = this._format(this.stop - this.step); 86 86 }, 87 87 join: function(str) { … … 91 91 } 92 92 }; 93 94 function NumericRange(name, start, stop, step, strl) { 95 this._format = function(val) { 96 let rv = String(Math.abs(val)); 97 while (rv.length < this.strl) { 98 rv = '0' + rv; 99 } 100 if (val < 0) { 101 return '-' + rv; 102 } 103 return rv; 104 }; 105 this.strl = strl; 106 107 this.init(name, start, stop + (step > 0 ? 1 : -1), step); 108 }; 109 NumericRange.prototype = Range.prototype; 93 110 function CharRange(name, start, stop, step) { 94 this.name = name; 95 this.start = start; 96 this.stop = stop + (start > stop ? -1 : 1); 97 this.step = step; 98 this.length = Math.floor((stop - start) / step + 1); 99 }; 100 CharRange.prototype = { 101 join: function(str) { 102 for (let i in range(this.start, this.stop, this.step)) { 103 yield str + String.fromCharCode(i); 104 } 105 } 106 } 111 this._format = String.fromCharCode; 112 113 this.init(name, start, stop + (step > 0 ? 1 : -1), step); 114 }; 115 CharRange.prototype = Range.prototype; 116 107 117 function BatchGenerator(link) { 108 118 if (!(link instanceof DTA_URL)) { … … 119 129 url = url.slice(i); 120 130 } 121 varm;131 let m; 122 132 if ((m = url.match(/^\[(-?\d+):(-?\d+)(?::(-?\d+))?\]/))) { 123 133 url = url.slice(m[0].length); 124 134 try { 125 varstart = new Number(m[1]);126 varstop = new Number(m[2]);127 varstep = stop > start ? 1 : -1;135 let start = new Number(m[1]); 136 let stop = new Number(m[2]); 137 let step = stop > start ? 1 : -1; 128 138 if (m.length > 3 && typeof(m[3]) != 'undefined') { 129 139 step = new Number(m[3]); … … 142 152 } 143 153 catch (ex) { 154 Debug.dump(ex); 144 155 this._pats.push(new Literal(m[0])); 145 156 } … … 150 161 url = url.slice(m[0].length); 151 162 try { 152 varstart = m[1].charCodeAt(0);153 varstop = m[2].charCodeAt(0);154 varstep = stop > start ? 1 : -1;163 let start = m[1].charCodeAt(0); 164 let stop = m[2].charCodeAt(0); 165 let step = stop > start ? 1 : -1; 155 166 if (m.length > 3 && typeof(m[3]) != 'undefined') { 156 167 step = new Number(m[3]); … … 164 175 } 165 176 catch (ex) { 177 Debug.dump(ex); 166 178 this._pats.push(new Literal(m[0])); 167 179 } 168 180 continue; 169 }170 if ((m = url.match(/\[.*?\]/))) {171 url = url.slice(m[0].length);172 this._pats.push(new Literal(m[0]));173 181 } 174 182 } … … 224 232 return this._pats.map( 225 233 function(p) { 226 if (!(p instanceof Literal)) { 227 return p.start; 228
