MozillaZine

[Ext] userChrome.js

Announce and Discuss the Latest Theme and Extension Releases.
old zeniko
 
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post Posted November 10th, 2006, 9:46 am

A few snippets exclusively for Firefox 2:
<li><a href="data:text/javascript,%2F*%20%3A%3A%3A%3A%3A%3A%3A%3A%20Fashion%20Tabs%20%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%20*%2F%0A%0A(%7B%0A%09init%3A%20function()%0A%09%7B%0A%09%09Array.forEach(getBrowser().mTabs%2C%20function(aTab)%20%7B%0A%09%09%09aTab.linkedBrowser.addProgressListener(this)%3B%0A%09%09%7D%2C%20this)%3B%0A%09%09%0A%09%09gBrowser.addEventListener(%22TabOpen%22%2C%20this%2C%20false)%3B%0A%09%09gBrowser.addEventListener(%22TabSelect%22%2C%20this%2C%20false)%3B%0A%09%09gBrowser.addEventListener(%22TabMove%22%2C%20this%2C%20false)%3B%0A%09%09gBrowser.addEventListener(%22TabClose%22%2C%20this%2C%20false)%3B%0A%09%7D%2C%0A%0A%09handleEvent%3A%20function(aEvent)%0A%09%7B%0A%09%09var%20tab%20%3D%20aEvent.originalTarget%3B%0A%09%09%0A%09%09switch%20(aEvent.type)%0A%09%09%7B%0A%09%09case%20%22TabOpen%22%3A%0A%09%09%09tab.linkedBrowser.addProgressListener(this)%3B%0A%09%09%09break%3B%0A%09%09case%20%22TabMove%22%3A%0A%09%09case%20%22TabSelect%22%3A%0A%09%09%09this.colorizeTab(tab)%3B%0A%09%09%09break%3B%0A%09%09case%20%22TabClose%22%3A%0A%09%09%09tab.linkedBrowser.removeProgressListener(this)%3B%0A%09%09%09break%3B%0A%09%09%7D%0A%09%7D%2C%0A%0A%09onLocationChange%3A%20function(aProgress%2C%20aRequest%2C%20aURI)%20%7B%0A%09%09var%20doc%20%3D%20aProgress.DOMWindow.document%3B%0A%09%09var%20tab%20%3D%20gBrowser.mTabs%5BgBrowser.getBrowserIndexForDocument(doc)%5D%3B%0A%09%09%0A%09%09this.colorizeTab(tab)%3B%0A%09%7D%2C%0A%0A%09onStateChange%3A%20function()%20%7B%20%7D%2C%0A%09onProgressChange%3A%20function()%20%7B%20%7D%2C%0A%09onStatusChange%3A%20function()%20%7B%20%7D%2C%0A%09onSecurityChange%3A%20function()%20%7B%20%7D%2C%0A%09onLinkIconAvailable%3A%20function()%20%7B%20%7D%2C%0A%0A%09colorizeTab%3A%20function(aTab)%0A%09%7B%0A%09%09function%20djb2hash(aString)%0A%09%09%7B%0A%09%09%09var%20hashvalue%20%3D%205381%3B%0A%09%09%09for%20(var%20i%20%3D%200%3B%20i%20%3C%20aString.length%3B%20i%2B%2B)%0A%09%09%09%7B%0A%09%09%09%09hashvalue%20%3D%20((hashvalue%20%3C%3C%205)%20%2B%20hashvalue)%20%2B%20aString.charCodeAt(i)%3B%0A%09%09%09%7D%0A%09%09%09return%20hashvalue%3B%0A%09%09%7D%0A%09%09%0A%09%09try%0A%09%09%7B%0A%09%09%09var%20host%20%3D%20aTab.linkedBrowser.currentURI.host%3B%0A%09%09%7D%0A%09%09catch%20(ex)%20%7B%20%7D%0A%09%09%0A%09%09if%20(host%20%26%26%20host%20!%3D%20%22about%3Ablank%22)%0A%09%09%7B%0A%09%09%09var%20hue%20%3D%20djb2hash(host.replace(%2F%5Ewww%5C.(%3F%3D.%2B%5C..)%2F%2C%20%22%22))%20%25%20360%3B%0A%09%09%7D%0A%09%09var%20color%20%3D%20(hue)%3F%22hsl(%22%20%2B%20hue%20%2B%20%22%2C%2050%25%2C%2050%25)%22%3Anull%3B%0A%09%09%0A%09%09Array.forEach(aTab.ownerDocument.getAnonymousNodes(aTab)%2C%20function(aNode)%20%7B%0A%09%09%09aNode.style.backgroundColor%20%3D%20color%3B%0A%09%09%7D)%3B%0A%09%09%0A%09%09if%20(gBrowser.selectedTab%20%3D%3D%20aTab)%0A%09%09%7B%0A%09%09%09var%20node%20%3D%20aTab.ownerDocument.getAnonymousElementByAttribute(aTab.parentNode%2C%20%22class%22%2C%20%22tabs-bottom%22)%3B%0A%09%09%09if%20(color)%0A%09%09%09%09node.setAttribute(%22style%22%2C%20%22background-color%3A%20%22%20%2B%20color%20%2B%20%22%20!important%22)%3B%0A%09%09%09else%0A%09%09%09%09node.removeAttribute(%22style%22)%3B%0A%09%09%7D%0A%09%7D%2C%0A%0A%09QueryInterface%3A%20function(aIID)%20%7B%0A%09%09var%20Ci%20%3D%20Components.interfaces%3B%0A%09%09if%20(!%5BCi.nsIDOMEventListener%2C%20Ci.nsIWebProgressListener%2C%20Ci.nsISupportsWeakReference%2C%20Ci.nsISupports%5D.some(aIID.equals))%0A%09%09%7B%0A%09%09%09throw%20Components.results.NS_NOINTERFACE%3B%0A%09%09%7D%0A%09%09return%20this%3B%0A%09%7D%0A%7D).init()%3B%0A">Fashion Tabs</a> (Chromatabs lite; only tested with the default theme under Windows)
<li><a href="data:text/javascript,%2F*%20%3A%3A%3A%3A%3A%3A%3A%3A%20Undo%20Close%20Tab%20Menu%20%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%20*%2F%0A%0Avar%20UndoCloseTabMenu%20%3D%20%7B%0A%09mSavePref%3A%20%22extensions.userchrome_js.uctm_state%22%2C%0A%0A%09init%3A%20function()%0A%09%7B%0A%09%09this.mSS%20%3D%20Components.classes%5B%22%40mozilla.org%2Fbrowser%2Fsessionstore%3B1%22%5D.getService(Components.interfaces.nsISessionStore)%3B%0A%09%09%0A%09%09var%20dts%20%3D%20document.getElementById(%22devToolsSeparator%22)%3B%0A%09%09var%20menu%20%3D%20dts.parentNode.insertBefore(document.createElement(%22menu%22)%2C%20dts.parentNode.firstChild)%3B%0A%09%09%0A%09%09menu.setAttribute(%22label%22%2C%20%22Undo%20Close%20Tab%22)%3B%0A%09%09menu.setAttribute(%22accesskey%22%2C%20%22U%22)%3B%0A%09%09%0A%09%09this._popup%20%3D%20menu.appendChild(document.createElement(%22menupopup%22))%3B%0A%09%09this._popup.setAttribute(%22onpopupshowing%22%2C%20%22UndoCloseTabMenu.onPopupShowing()%3B%22)%3B%0A%09%7D%2C%0A%0A%09onPopupShowing%3A%20function()%0A%09%7B%0A%09%09while%20(this._popup.hasChildNodes())%0A%09%09%7B%0A%09%09%09this._popup.removeChild(this._popup.lastChild)%3B%0A%09%09%7D%0A%09%09%0A%09%09var%20undoItems%20%3D%20eval(%22(%22%20%2B%20this.mSS.getClosedTabData(window)%20%2B%20%22)%22)%3B%0A%09%09for%20(var%20i%20%3D%200%3B%20i%20%3C%20undoItems.length%3B%20i%2B%2B)%0A%09%09%7B%0A%09%09%09var%20key%20%3D%20(i%20%3C%209)%3Fi%20%2B%201%3A(i%20%3D%3D%209)%3F%220%22%3A%22%22%3B%0A%09%09%09var%20menuitem%20%3D%20this._popup.appendChild(document.createElement(%22menuitem%22))%3B%0A%09%09%09menuitem.setAttribute(%22label%22%2C%20((key)%3Fkey%20%2B%20%22)%20%22%3A%22%22)%20%2B%20undoItems%5Bi%5D.title)%3B%0A%09%09%09menuitem.setAttribute(%22accesskey%22%2C%20key)%3B%0A%09%09%09menuitem.setAttribute(%22oncommand%22%2C%20%22undoCloseTab(%22%20%2B%20i%20%2B%20%22)%3B%22)%3B%0A%09%09%7D%0A%09%09if%20(undoItems.length%20%3E%200)%0A%09%09%7B%0A%09%09%09this._popup.appendChild(document.createElement(%22menuseparator%22))%3B%0A%09%09%7D%0A%09%09%0A%09%09var%20savedTabs%20%3D%20gPrefService.prefHasUserValue(this.mSavePref)%3B%0A%09%09menuitem%20%3D%20this._popup.appendChild(document.createElement(%22menuitem%22))%3B%0A%09%09menuitem.setAttribute(%22label%22%2C%20(savedTabs)%3F%22Restore%20Saved%20Window%22%3A%22Save%20Current%20Window%22)%3B%0A%09%09menuitem.setAttribute(%22accesskey%22%2C%20(savedTabs)%3F%22R%22%3A%22S%22)%3B%0A%09%09menuitem.setAttribute(%22oncommand%22%2C%20%22UndoCloseTabMenu.saveRestore(event)%3B%22)%3B%0A%09%09if%20(savedTabs)%0A%09%09%7B%0A%09%09%09menuitem.setAttribute(%22style%22%2C%20%22font-weight%3A%20bold%3B%22)%3B%0A%09%09%7D%0A%09%7D%2C%0A%0A%09saveRestore%3A%20function(aEvent)%0A%09%7B%0A%09%09if%20(gPrefService.prefHasUserValue(this.mSavePref))%0A%09%09%7B%0A%09%09%09var%20state%20%3D%20gPrefService.getCharPref(this.mSavePref)%3B%0A%09%09%09if%20(aEvent.ctrlKey)%0A%09%09%09%7B%0A%09%09%09%09var%20tabcount%20%3D%20gBrowser.mTabs.length%20%2B%20(eval(state).windows%5B0%5D.selected%20%7C%7C%201)%20-%201%3B%0A%09%09%09%7D%0A%09%09%09this.mSS.setWindowState(window%2C%20state%2C%20!aEvent.ctrlKey)%3B%0A%09%09%09if%20(aEvent.ctrlKey)%0A%09%09%09%7B%0A%09%09%09%09setTimeout(function(aTab)%20%7B%0A%09%09%09%09%09gBrowser.selectedTab%20%3D%20aTab%3B%0A%09%09%09%09%7D%2C%20100%2C%20gBrowser.mTabs%5Btabcount%5D)%3B%0A%09%09%09%7D%0A%09%09%09gPrefService.deleteBranch(this.mSavePref)%3B%0A%09%09%7D%0A%09%09else%0A%09%09%7B%0A%09%09%09gPrefService.setCharPref(this.mSavePref%2C%20%22(%22%20%2B%20this.mSS.getWindowState(window)%20%2B%20%22)%22)%3B%0A%09%09%7D%0A%09%7D%0A%7D%3B%0A%0Aif%20(Components.interfaces.nsISessionStore)%0A%7B%0A%09UndoCloseTabMenu.init()%3B%0A%09%0A%09getBrowser().undoRemoveTab%20%3D%20undoCloseTab%3B%0A%7D%0A">Undo Close Tab Menu</a> (moves the Recently Closed Tabs menu over to Tools for when you've hidden the History menu; and adds a one-shot session saving/restoring function)
<li><a href="data:text/javascript,%2F*%20%3A%3A%3A%3A%3A%3A%3A%3A%20Drag'n'Duplicate%20%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%20*%2F%0A%0AgBrowser.duplicateTab%20%3D%20function(aTab)%20%7B%0A%09var%20ss%20%3D%20Components.classes%5B%22%40mozilla.org%2Fbrowser%2Fsessionstore%3B1%22%5D.getService(Components.interfaces.nsISessionStore)%3B%0A%09var%20state%20%3D%20ss.getWindowState(aTab.ownerDocument.defaultView)%3B%0A%09state%20%3D%20eval(%22(%22%20%2B%20state%20%2B%20%22)%22)%3B%0A%09state.windows%5B0%5D.tabs%20%3D%20state.windows%5B0%5D.tabs.splice(aTab._tPos%2C%201)%3B%0A%09ss.setWindowState(window%2C%20state.toSource()%2C%20false)%3B%0A%09%0A%09return%20document.getAnonymousElementByAttribute(this%2C%20%22linkedpanel%22%2C%20this.mPanelContainer.lastChild.id)%3B%0A%7D%3B%0A%0AgBrowser.__preUC_onDrop%20%3D%20gBrowser.onDrop%3B%0AgBrowser.onDrop%20%3D%20function(aEvent%2C%20aXferData%2C%20aDragSession)%20%7B%0A%09if%20(aDragSession.sourceNode%20%26%26%20aDragSession.sourceNode.localName%20%3D%3D%20%22tab%22)%0A%09%7B%0A%09%09var%20oldTab%20%3D%20aDragSession.sourceNode%3B%0A%09%09if%20(aEvent.ctrlKey)%0A%09%09%7B%0A%09%09%09var%20tab%20%3D%20this.duplicateTab(oldTab)%3B%0A%09%09%09if%20(oldTab.parentNode%20!%3D%20this.mTabContainer)%0A%09%09%09%7B%0A%09%09%09%09this.selectedTab%20%3D%20tab%3B%0A%09%09%09%7D%0A%09%09%09this.moveTabTo(tab%2C%20this.getNewIndex(aEvent))%3B%0A%09%09%09return%3B%0A%09%09%7D%0A%09%09if%20(oldTab.parentNode%20!%3D%20this.mTabContainer)%0A%09%09%7B%0A%09%09%09this.selectedTab%20%3D%20this.duplicateTab(oldTab)%3B%0A%09%09%09this.moveTabTo(this.selectedTab%2C%20this.getNewIndex(aEvent))%3B%0A%09%09%09oldTab.ownerDocument.defaultView.gBrowser.removeTab(oldTab)%3B%0A%09%09%09window.focus()%3B%0A%09%09%09return%3B%0A%09%09%7D%0A%09%7D%0A%09gBrowser.__preUC_onDrop(aEvent%2C%20aXferData%2C%20aDragSession)%3B%0A%7D%3B%0A%0AgBrowser.__preUC_onDragOver%20%3D%20gBrowser.onDragOver%3B%0AgBrowser.onDragOver%20%3D%20function(aEvent%2C%20aFlavour%2C%20aDragSession)%20%7B%0A%09if%20(aDragSession.sourceNode%20%26%26%20aDragSession.sourceNode.localName%20%3D%3D%20%22tab%22%20%26%26%20aDragSession.sourceNode.parentNode%20!%3D%20this.mTabContainer)%0A%09%7B%0A%09%09aDragSession%20%3D%20%7B%20canDrop%3A%20aDragSession.canDrop%2C%20sourceNode%3A%20this.selectedTab%20%7D%3B%0A%09%7D%0A%09this.__preUC_onDragOver(aEvent%2C%20aFlavour%2C%20aDragSession)%3B%0A%7D%3B%0A">Drag'n'Duplicate</a> (allows to move tabs between windows and copy tabs through drag&drop; cf. Copy Dragged Tab)

pile0nades
 
Posts: 756
Joined: May 15th, 2005, 2:31 am

Post Posted November 10th, 2006, 11:35 pm

Thanks for these new scripts zeniko! The Fashion Tabs is a neat concept. I made it look more pleasant/readable though, by setting the luminosity to 85%.
Linkify bug numbers - test: bug 258287

Lost User 246017
 
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post Posted November 12th, 2006, 7:13 am

Thanks zeniko, I'll give your code a try. I've already got the extension installed and included the code to put the Find bar at the top, which works perfectly.

Old Greg S
 
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post Posted November 12th, 2006, 11:44 am

Duke D wrote:
For the record im having the same issue, tho i havent tried Greg's code, if i try the modified i see only a 0, if i leave it as is, i lose the 0s



I don't think I've posted what I'm using. I've played with all variations and found this to work, mostly. The only problem I have with this, is that when the time is between 12:00 AM to 1:00AM the time will show as double zeros(00:30) for the hours(12:30AM). Anyone know a way to fix?

Edit: Nevermind my question above, I've fixed and edited the code to reflect. Of course one would need to edit out the parts you wouldn't want or need.


Code: Select all
 function Clock() {
    var title = content.document.title;
    var days = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
    var months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
    var D = new Date();
    var day = days[D.getDay()];
    var month = months[D.getMonth()];
    var year = D.getFullYear();
    var hours = D.getHours();
    var min = D.getMinutes();
    var sec = D.getSeconds();
    var Time = ((hours > 12) ? hours - 12 :(hours == 0) ? 12 :hours);
    Time += ((min < 10) ? ":0" : ":") + min;
    Time += ((sec <10>= 12) ? " PM" : " AM";
    var date = "*   Greg's Firefox 1.5   *   " + day + ", " + month + " " + D.getDate() + ", " + year;
    var timestr = date + "   " + Time;
    document.title = title + "   " + timestr;
    setTimeout("Clock()",100);
  }

 Clock();

pile0nades
 
Posts: 756
Joined: May 15th, 2005, 2:31 am

Post Posted November 13th, 2006, 3:23 am

Sub-XUL Loader

Based on the Sub-Script Loader, this script will automatically load all files ending in .uc.xul from the chrome folder as XUL overlays. It removes the need for userChrome.xul and xul-overlay tags pointing to separate files.

<a href="data:text/javascript;charset=utf-8;base64,LyogOjo6Ojo6OjogU3ViLVhVTCBMb2FkZXIgOjo6Ojo6Ojo6Ojo6Ojo6ICovDQoNCi8vIGF1dG9tYXRpY2FsbHkgaW5jbHVkZXMgYWxsIGZpbGVzIGVuZGluZyBpbiAudWMueHVsIGZyb20gdGhlIHByb2ZpbGUncyBjaHJvbWUgZm9sZGVyDQoNCihmdW5jdGlvbigpIHsNCiAgdmFyIGNocm9tZURpciA9IENvbXBvbmVudHMuY2xhc3Nlc1siQG1vemlsbGEub3JnL2ZpbGUvZGlyZWN0b3J5X3NlcnZpY2U7MSJdLmdldFNlcnZpY2UoQ29tcG9uZW50cy5pbnRlcmZhY2VzLm5zSVByb3BlcnRpZXMpLmdldCgiVUNocm0iLCBDb21wb25lbnRzLmludGVyZmFjZXMubnNJTG9jYWxGaWxlKTsNCiAgdmFyIGZpbGVzID0gY2hyb21lRGlyLmRpcmVjdG9yeUVudHJpZXMuUXVlcnlJbnRlcmZhY2UoQ29tcG9uZW50cy5pbnRlcmZhY2VzLm5zSVNpbXBsZUVudW1lcmF0b3IpOw0KICBpZihmaWxlcy5oYXNNb3JlRWxlbWVudHMoKSkgbG9hZFhVTChmaWxlcyk7DQoNCiAgZnVuY3Rpb24gbG9hZFhVTChmaWxlcykgew0KICAgIHZhciBmaWxlID0gZmlsZXMuZ2V0TmV4dCgpLlF1ZXJ5SW50ZXJmYWNlKENvbXBvbmVudHMuaW50ZXJmYWNlcy5uc0lGaWxlKTsNCiAgICBpZiAoL1wudWNcLnh1bCQvaS50ZXN0KGZpbGUubGVhZk5hbWUpKSB7DQogICAgICBkb2N1bWVudC5sb2FkT3ZlcmxheShDb21wb25lbnRzLmNsYXNzZXNbIkBtb3ppbGxhLm9yZy9uZXR3b3JrL2lvLXNlcnZpY2U7MSJdLmdldFNlcnZpY2UoQ29tcG9uZW50cy5pbnRlcmZhY2VzLm5zSUlPU2VydmljZSkuZ2V0UHJvdG9jb2xIYW5kbGVyKCJmaWxlIikuUXVlcnlJbnRlcmZhY2UoQ29tcG9uZW50cy5pbnRlcmZhY2VzLm5zSUZpbGVQcm90b2NvbEhhbmRsZXIpLmdldFVSTFNwZWNGcm9tRmlsZShmaWxlKSwgbnVsbCk7DQogICAgfQ0KICAgIGlmKGZpbGVzLmhhc01vcmVFbGVtZW50cygpKSBzZXRUaW1lb3V0KGxvYWRYVUwsIDAsIGZpbGVzKTsNCiAgfQ0KfSkoKTs%3D">download</a><br><br>
Linkify bug numbers - test: bug 258287

Lost User 246017
 
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post Posted November 13th, 2006, 9:25 pm

Thanks again zeniko, copied in your code and it works like a charm. Now I don't have to worry about it when browser.js gets overwritten after an update.

Also added in the code to put the Undo Close Tab Menu under tools, which is excellent because I can hide the History menu since the undo feature is all it was needed for. Nice job.

SilentJ
 
Posts: 251
Joined: November 8th, 2002, 6:42 am

Post Posted November 14th, 2006, 1:34 pm

zeniko wrote:A few snippets exclusively for Firefox 2:
<li><a href="data:text/javascript,%2F*%20%3A%3A%3A%3A%3A%3A%3A%3A%20Undo%20Close%20Tab%20Menu%20%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%20*%2F%0A%0Avar%20UndoCloseTabMenu%20%3D%20%7B%0A%09mSavePref%3A%20%22extensions.userchrome_js.uctm_state%22%2C%0A%0A%09init%3A%20function()%0A%09%7B%0A%09%09this.mSS%20%3D%20Components.classes%5B%22%40mozilla.org%2Fbrowser%2Fsessionstore%3B1%22%5D.getService(Components.interfaces.nsISessionStore)%3B%0A%09%09%0A%09%09var%20dts%20%3D%20document.getElementById(%22devToolsSeparator%22)%3B%0A%09%09var%20menu%20%3D%20dts.parentNode.insertBefore(document.createElement(%22menu%22)%2C%20dts.parentNode.firstChild)%3B%0A%09%09%0A%09%09menu.setAttribute(%22label%22%2C%20%22Undo%20Close%20Tab%22)%3B%0A%09%09menu.setAttribute(%22accesskey%22%2C%20%22U%22)%3B%0A%09%09%0A%09%09this._popup%20%3D%20menu.appendChild(document.createElement(%22menupopup%22))%3B%0A%09%09this._popup.setAttribute(%22onpopupshowing%22%2C%20%22UndoCloseTabMenu.onPopupShowing()%3B%22)%3B%0A%09%7D%2C%0A%0A%09onPopupShowing%3A%20function()%0A%09%7B%0A%09%09while%20(this._popup.hasChildNodes())%0A%09%09%7B%0A%09%09%09this._popup.removeChild(this._popup.lastChild)%3B%0A%09%09%7D%0A%09%09%0A%09%09var%20undoItems%20%3D%20eval(%22(%22%20%2B%20this.mSS.getClosedTabData(window)%20%2B%20%22)%22)%3B%0A%09%09for%20(var%20i%20%3D%200%3B%20i%20%3C%20undoItems.length%3B%20i%2B%2B)%0A%09%09%7B%0A%09%09%09var%20key%20%3D%20(i%20%3C%209)%3Fi%20%2B%201%3A(i%20%3D%3D%209)%3F%220%22%3A%22%22%3B%0A%09%09%09var%20menuitem%20%3D%20this._popup.appendChild(document.createElement(%22menuitem%22))%3B%0A%09%09%09menuitem.setAttribute(%22label%22%2C%20((key)%3Fkey%20%2B%20%22)%20%22%3A%22%22)%20%2B%20undoItems%5Bi%5D.title)%3B%0A%09%09%09menuitem.setAttribute(%22accesskey%22%2C%20key)%3B%0A%09%09%09menuitem.setAttribute(%22oncommand%22%2C%20%22undoCloseTab(%22%20%2B%20i%20%2B%20%22)%3B%22)%3B%0A%09%09%7D%0A%09%09if%20(undoItems.length%20%3E%200)%0A%09%09%7B%0A%09%09%09this._popup.appendChild(document.createElement(%22menuseparator%22))%3B%0A%09%09%7D%0A%09%09%0A%09%09var%20savedTabs%20%3D%20gPrefService.prefHasUserValue(this.mSavePref)%3B%0A%09%09menuitem%20%3D%20this._popup.appendChild(document.createElement(%22menuitem%22))%3B%0A%09%09menuitem.setAttribute(%22label%22%2C%20(savedTabs)%3F%22Restore%20Saved%20Window%22%3A%22Save%20Current%20Window%22)%3B%0A%09%09menuitem.setAttribute(%22accesskey%22%2C%20(savedTabs)%3F%22R%22%3A%22S%22)%3B%0A%09%09menuitem.setAttribute(%22oncommand%22%2C%20%22UndoCloseTabMenu.saveRestore(event)%3B%22)%3B%0A%09%09if%20(savedTabs)%0A%09%09%7B%0A%09%09%09menuitem.setAttribute(%22style%22%2C%20%22font-weight%3A%20bold%3B%22)%3B%0A%09%09%7D%0A%09%7D%2C%0A%0A%09saveRestore%3A%20function(aEvent)%0A%09%7B%0A%09%09if%20(gPrefService.prefHasUserValue(this.mSavePref))%0A%09%09%7B%0A%09%09%09var%20state%20%3D%20gPrefService.getCharPref(this.mSavePref)%3B%0A%09%09%09if%20(aEvent.ctrlKey)%0A%09%09%09%7B%0A%09%09%09%09var%20tabcount%20%3D%20gBrowser.mTabs.length%20%2B%20(eval(state).windows%5B0%5D.selected%20%7C%7C%201)%20-%201%3B%0A%09%09%09%7D%0A%09%09%09this.mSS.setWindowState(window%2C%20state%2C%20!aEvent.ctrlKey)%3B%0A%09%09%09if%20(aEvent.ctrlKey)%0A%09%09%09%7B%0A%09%09%09%09setTimeout(function(aTab)%20%7B%0A%09%09%09%09%09gBrowser.selectedTab%20%3D%20aTab%3B%0A%09%09%09%09%7D%2C%20100%2C%20gBrowser.mTabs%5Btabcount%5D)%3B%0A%09%09%09%7D%0A%09%09%09gPrefService.deleteBranch(this.mSavePref)%3B%0A%09%09%7D%0A%09%09else%0A%09%09%7B%0A%09%09%09gPrefService.setCharPref(this.mSavePref%2C%20%22(%22%20%2B%20this.mSS.getWindowState(window)%20%2B%20%22)%22)%3B%0A%09%09%7D%0A%09%7D%0A%7D%3B%0A%0Aif%20(Components.interfaces.nsISessionStore)%0A%7B%0A%09UndoCloseTabMenu.init()%3B%0A%09%0A%09getBrowser().undoRemoveTab%20%3D%20undoCloseTab%3B%0A%7D%0A">Undo Close Tab Menu</a> (moves the Recently Closed Tabs menu over to Tools for when you've hidden the History menu; and adds a one-shot session saving/restoring function)

Genius! ...I've been messing around trying to create that save session function for so long....I never would of got there.

Thanks man

Zoolcar9

User avatar
 
Posts: 2225
Joined: November 9th, 2004, 6:45 pm
Location: Jakarta, Indonesia (UTC+7)

Post Posted November 15th, 2006, 9:33 am


Updated Element Inspector
Added: "Inspect Bookmark" on Bookmarks context menu

My Firefox information | Add-ons | GitHub

"With great power, comes great desire to show it off."

SilentJ
 
Posts: 251
Joined: November 8th, 2002, 6:42 am

Post Posted November 15th, 2006, 12:49 pm

shamelessly based on zeniko's 'undo close tab menu' code. I've knocked up 'tab session manager' which just allows you to save/restore (doesn't delete on restore) and delete a tab session (i didn't need the undo closed tab bit)

<a href="data:text/javascript,%2F*%20%3A%3A%3A%3A%3A%3A%3A%3A%20Tab%20Session%20Manager%20%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%20*%2F%0A%0Avar%20UndoCloseTabMenu%20%3D%20%7B%0A%20%20mSavePref%3A%20%22extensions.userchrome_js.savedtabs%22%2C%0A%0A%20%20init%3A%20function%28%29%0A%20%20%7B%0A%20%20%20%20this.mSS%20%3D%20Components.classes%5B%22@mozilla.org/browser/sessionstore%3B1%22%5D.getService%28Components.interfaces.nsISessionStore%29%3B%0A%0A%20%20%20%20var%20jsConsole%20%3D%20document.getElementById%28%22javascriptConsole%22%29%3B%0A%20%20%20%20var%20menu%20%3D%20jsConsole.parentNode.insertBefore%28document.createElement%28%22menu%22%29%2C%20jsConsole%29%3B%0A%0A%20%20%20%20menu.setAttribute%28%22label%22%2C%20%22Tab%20Session%20Manager%22%29%3B%0A%0A%20%20%20%20this._popup%20%3D%20menu.appendChild%28document.createElement%28%22menupopup%22%29%29%3B%0A%20%20%20%20this._popup.setAttribute%28%22onpopupshowing%22%2C%20%22UndoCloseTabMenu.onPopupShowing%28%29%3B%22%29%3B%0A%20%20%7D%2C%0A%0A%20%20onPopupShowing%3A%20function%28%29%0A%20%20%7B%0A%20%20%20%20while%20%28this._popup.hasChildNodes%28%29%29%0A%20%20%20%20%7B%0A%20%20%20%20%20%20this._popup.removeChild%28this._popup.lastChild%29%3B%0A%20%20%20%20%7D%0A%0A%20%20%20%20var%20savedTabs%20%3D%20gPrefService.prefHasUserValue%28this.mSavePref%29%3B%0A%20%20%20%20menuitem%20%3D%20this._popup.appendChild%28document.createElement%28%22menuitem%22%29%29%3B%0A%20%20%20%20menuitem.setAttribute%28%22label%22%2C%20%28savedTabs%29%3F%22Restore%20Saved%20Tabs%22%3A%22Save%20Tabs%22%29%3B%0A%20%20%20%20menuitem.setAttribute%28%22oncommand%22%2C%20%22UndoCloseTabMenu.saveRestore%28event%29%3B%22%29%3B%0A%20%20%20%20if%20%28savedTabs%29%0A%20%20%20%20%7B%0A%20%20%20%20menuitem2%20%3D%20this._popup.appendChild%28document.createElement%28%22menuseperator%22%29%29%3B%0A%20%20%20%20menuitem3%20%3D%20this._popup.appendChild%28document.createElement%28%22menuitem%22%29%29%3B%0A%20%20%20%20menuitem3.setAttribute%28%22label%22%2C%20%22Delete%20Saved%20Tabs%22%29%3B%0A%20%20%20%20menuitem3.setAttribute%28%22oncommand%22%2C%20%22UndoCloseTabMenu.deleteSaved%28%29%3B%22%29%3B%0A%20%20%20%20%7D%0A%20%20%7D%2C%0A%0A%20%20saveRestore%3A%20function%28aEvent%29%0A%20%20%7B%0A%20%20%20%20if%20%28gPrefService.prefHasUserValue%28this.mSavePref%29%29%0A%20%20%20%20%7B%0A%20%20%20%20%20%20var%20state%20%3D%20gPrefService.getCharPref%28this.mSavePref%29%3B%0A%20%20%20%20%20%20if%20%28aEvent.ctrlKey%29%0A%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20var%20tabcount%20%3D%20gBrowser.mTabs.length%20%20%20%28eval%28state%29.windows%5B0%5D.selected%20%7C%7C%201%29%20-%201%3B%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20this.mSS.setWindowState%28window%2C%20state%2C%20%21aEvent.ctrlKey%29%3B%0A%20%20%20%20%20%20if%20%28aEvent.ctrlKey%29%0A%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20setTimeout%28function%28aTab%29%20%7B%0A%20%20%20%20%20%20%20%20%20%20gBrowser.selectedTab%20%3D%20aTab%3B%0A%20%20%20%20%20%20%20%20%7D%2C%20100%2C%20gBrowser.mTabs%5Btabcount%5D%29%3B%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20//gPrefService.deleteBranch%28this.mSavePref%29%3B%0A%20%20%20%20%7D%0A%20%20%20%20else%0A%20%20%20%20%7B%0A%20%20%20%20%20%20gPrefService.setCharPref%28this.mSavePref%2C%20%22%28%22%20%20%20this.mSS.getWindowState%28window%29%20%20%20%22%29%22%29%3B%0A%20%20%20%20%7D%0A%20%20%7D%2C%0A%20%20%0A%20%20deleteSaved%3A%20function%28%29%0A%20%20%7B%0A%20%20%20%20%20%20gPrefService.deleteBranch%28this.mSavePref%29%3B%0A%20%20%7D%0A%20%20%0A%7D%3B%0A%0Aif%20%28Components.interfaces.nsISessionStore%29%0A%7B%0A%20%20UndoCloseTabMenu.init%28%29%3B%0A%0A%20%20getBrowser%28%29.undoRemoveTab%20%3D%20undoCloseTab%3B%0A%7D">Tab Session Manager</a>

thanks to zeniko

paulfox
 
Posts: 1510
Joined: May 8th, 2004, 1:38 pm

Post Posted November 15th, 2006, 2:51 pm

May I ask you (all) if the 3 snippets (top of page) from Zeniko or this one from SilentJ above need script-loader or XUL-loader to work? So far I've only got 3 .js scripts, and they don't require it - wondering if these do.

I've tried "loading" those two script loaders followed by other snippets and they're not working, and unfortunately I'm not bright enough to figure it out. Apparently the XUL loader takes the place of repeated "taggings," (COOL!) but I'm wondering if these others above (zeniko's top of page and Silent J's) require anything other than putting in userChrome.js.

Also, is there a way of telling (by looking @ code) if something needs window hook, XUL-sub loader or Script loader? And does it do any harm to LOAD those "loaders" into userChrome.js "just to have them" if nothing is applicable yet?

TIA. Good lord, this gets complicated. Worth it though - for the immense small-footprint benefits of having this stuff! Cheers/ p
PentiumIII/W2K, Toshiba AMD laptop/Vista. FX 3 on both.

Grist

User avatar
 
Posts: 836
Joined: January 27th, 2006, 9:20 pm

Post Posted November 15th, 2006, 3:40 pm

paulfox wrote:May I ask you (all) if the 3 snippets (top of page) from Zeniko or this one from SilentJ above need script-loader or XUL-loader to work? So far I've only got 3 .js scripts, and they don't require it - wondering if these do.

Those three scripts don't require anything other than userChrome.js. However, I do use the sub-loaders for convenience. I like to keep my scripts separated.

I've tried "loading" those two script loaders followed by other snippets and they're not working, and unfortunately I'm not bright enough to figure it out. Apparently the XUL loader takes the place of repeated "taggings," (COOL!) but I'm wondering if these others above (zeniko's top of page and Silent J's) require anything other than putting in userChrome.js.

The only scripts I keep in userChrome.js are the sub-loaders and the window hook: This is my userChrome.js: <a href="data:text/javascript;base64,LyogTG9hZCBTY3JpcHRzICovDQoNCihmdW5jdGlvbigpIHsNCg0KCXZhciBjaHJvbWVEaXIgPSBDb21wb25lbnRzLmNsYXNzZXNbIkBtb3ppbGxhLm9yZy9maWxlL2RpcmVjdG9yeV9zZXJ2aWNlOzEiXS5nZXRTZXJ2aWNlKENvbXBvbmVudHMuaW50ZXJmYWNlcy5uc0lQcm9wZXJ0aWVzKS5nZXQoIlVDaHJtIiwgQ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CQlDb21wb25lbnRzLmNsYXNzZXNbIkBtb3ppbGxhLm9yZy9vYnNlcnZlci1zZXJ2aWNlOzEiXS5nZXRTZXJ2aWNlKENvbXBvbmVudHMuaW50ZXJmYWNlcy5uc0lPYnNlcnZlclNlcnZpY2UpLmFkZE9ic2VydmVyKHRoaXMsICJkb213aW5kb3dvcGVuZWQiLCBmYWxzZSk7DQoJCX0NCgkJaWYgKCF0aGlzLm1GdW5jc1thVVJMXSkNCgkJew0KCQkJdGhpcy5tRnVuY3NbYVVSTF0gPSBbXTsNCgkJfQ0KCQl0aGlzLm1GdW5jc1thVVJMXS5wdXNoKGFGdW5jKTsNCgl9DQp9Ow%3D%3D">userChrome.js</a>
I modified the loaders so that I could keep my scripts and XUL files in their own directories: Chrome/Scripts/ and Chrome/XUL/.

Also, is there a way of telling (by looking @ code) if something needs window hook, XUL-sub loader or Script loader? And does it do any harm to LOAD those "loaders" into userChrome.js "just to have them" if nothing is applicable yet?

Nothing requires that you have the sub loader scripts but it is convenient. It also won't hurt to have the window hook in userChrome.js in case it's needed. You can easily tell if a script needs the window hook. See this script by Zoolcar9:
http://forums.mozillazine.org/viewtopic ... 53#2590753

When using the sub-loaders, script file names need to end with .uc.js and xul with .uc.xul.

Edit: Just to be clear, the script loader loads all files ending in .uc.js. When I add a new script, I simply create a new uc.js file in my Scripts directory. Same with xul files.
Last edited by Grist on November 15th, 2006, 5:13 pm, edited 2 times in total.

paulfox
 
Posts: 1510
Joined: May 8th, 2004, 1:38 pm

Post Posted November 15th, 2006, 3:43 pm

Perfect. Understood. Thanks a million!!
PentiumIII/W2K, Toshiba AMD laptop/Vista. FX 3 on both.

pile0nades
 
Posts: 756
Joined: May 15th, 2005, 2:31 am

Post Posted November 19th, 2006, 12:12 am

Copy Feed URL 2.0

This is an update of my Copy Feed URL script. It now supports pages with multiple feeds and has been greatly simplified.

<a href="data:text/javascript;charset=utf-8;base64,Ly8gQ29weSBGZWVkIFVSTCBtZW51aXRlbQ0KLy8gYnkg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iAgZ0NsaXBib2FyZEhlbHBlci5jb3B5U3RyaW5nKHVybCk7DQp9DQoNCg%3D%3D">copyfeedurl.uc.js</a>
Last edited by pile0nades on November 19th, 2006, 9:19 pm, edited 5 times in total.
Linkify bug numbers - test: bug 258287

dougeeebear

User avatar
 
Posts: 548
Joined: September 15th, 2005, 4:17 pm

Post Posted November 19th, 2006, 9:43 am

pile0nades,
Your Sub-XUL Loader is great!
It sure is a lot easier than the old way.

Regards,
Doug

alta88
 
Posts: 1003
Joined: January 28th, 2006, 3:08 pm

Post Posted November 19th, 2006, 11:47 am

pile0nades wrote:Copy Feed URL 2.0

brilliant (and elegant now that multiple feeds are handled ;) ). but it seems the menuitem is added on contexts other than the feed icon, when rt click in the menubar and other toolbars, even after having tabbed to a page with no feed icon. odd, since it looks like you check that rt click context is the icon...

it would be nice to in fact get rid of all that other stuff on feed icon rt click and only keep items that have to do with rss.

should be an rfe to make copy url standard on that icon.

Return to Extension/Theme Releases


Who is online

Users browsing this forum: No registered users and 2 guests