diff --git a/content/resurrect-select-mirror.xul b/content/resurrect-select-mirror.xul new file mode 100644 index 0000000..ba48a64 --- /dev/null +++ b/content/resurrect-select-mirror.xul @@ -0,0 +1,23 @@ + + + + + + + + + + + + diff --git a/content/resurrect.js b/content/resurrect.js index c9f03f6..712f7e1 100644 --- a/content/resurrect.js +++ b/content/resurrect.js @@ -1,5 +1,30 @@ +/* +Enumerating: document.location +document.location.hash = #x +document.location.host = www.google.com +document.location.hostname = www.google.com +document.location.href = http://www.google.com/search?q=foo&start=0&ie=utf-8&oe=utf-8&client=firefox-a&rls=org.mozilla:en-US:official#x +document.location.pathname = /search +document.location.port = +document.location.protocol = http: +document.location.search = ?q=foo&start=0&ie=utf-8&oe=utf-8&client=firefox-a&rls=org.mozilla:en-US:official +document.location.replace = function replace() { [native code] } +document.location.assign = function assign() { [native code] } +document.location.reload = function reload() { [native code] } +*/ + var resurrect={ - clickTarget:null, + + mirrors:[ + {name:'CoralCDN', id:'coralcdn'}, + {name:'Google Cache', id:'google'}, + {name:'Yahoo! Cache', id:'yahoo'}, + {name:'MSN Cache', id:'msn'}, + {name:'The Internet Archive', id:'archive'} + ], + + originalDoc:null, + gotoUrl:null, // // // // // // // // // // // // // // // // // // // // // // // // // // // @@ -68,9 +93,53 @@ var resurrect={ // // // // // // // // // // // // // // // // // // // // // // // // // // // showDialog:function(url) { - alert(url); + resurrect.originalDoc=getBrowser().contentWindow.document; + resurrect.gotoUrl=url; + + window.openDialog( + 'chrome://resurrect/content/resurrect-select-mirror.xul', + '_blank', + 'modal,centerscreen,resizable=no,chrome,dependent' + ); + }, + + loadMirrors:function() { + var listbox=document.getElementById('mirror'); + for (var i=0, mirror=null; mirror=resurrect.mirrors[i]; i++) { + var listitem=document.createElement('listitem'); + listitem.setAttribute('label', mirror.name); + listitem.setAttribute('value', mirror.id); + listbox.appendChild(listitem); + } + listbox.setAttribute('rows', listbox.getRowCount()); + }, + + selectMirror:function(event) { + var listbox=document.getElementById('mirror'); + + var gotoUrl=null; + + var rawUrl=opener.resurrect.gotoUrl; + var encUrl=encodeURIComponent(rawUrl); + + switch (listbox.value) { + case 'coralcdn': + gotoUrl=rawUrl.substring(0, 8)+ + rawUrl.substring(8).replace(/\//, '.nyud.net:8080/'); + break; + } + if (gotoUrl) { + opener.resurrect.originalDoc.location.assign(gotoUrl); + } + + //setTimeout avoids error message when selecting in listbox + setTimeout(window.close, 0); } +// // // // // // // // // // // // // // // // // // // // // // // // // // // + }//end var resurrect -window.addEventListener('load', resurrect.onLoad, false); +if ('undefined'!=typeof gBrowser) { + window.addEventListener('load', resurrect.onLoad, false); +} diff --git a/locale/en-US/overlay.dtd b/locale/en-US/overlay.dtd index 3ff6974..7599a2c 100644 --- a/locale/en-US/overlay.dtd +++ b/locale/en-US/overlay.dtd @@ -1,4 +1,5 @@ - - - - + + + + + \ No newline at end of file