PK 7content/PK 7content/bindings/PK 7content/settings/PK 7locale/PK 7 locale/ca-AD/PK 7locale/ca-AD/showcase/PK 7 locale/da-DK/PK 7locale/da-DK/showcase/PK 7 locale/de-DE/PK 7locale/de-DE/showcase/PK 7 locale/el-GR/PK 7locale/el-GR/showcase/PK 7 locale/en-US/PK 7locale/en-US/showcase/PK 7 locale/es-ES/PK 7locale/es-ES/showcase/PK 7 locale/fa-IR/PK 7locale/fa-IR/showcase/PK 7 locale/fi-FI/PK 7locale/fi-FI/showcase/PK 7 locale/fr-FR/PK 7locale/fr-FR/showcase/PK 7 locale/fy-NL/PK 7locale/fy-NL/showcase/PK 7 locale/hu-HU/PK 7locale/hu-HU/showcase/PK 7 locale/it-IT/PK 7locale/it-IT/showcase/PK 7 locale/ja-JP/PK 7locale/ja-JP/showcase/PK 7 locale/ko-KR/PK 7locale/ko-KR/showcase/PK 7 locale/nl-NL/PK 7locale/nl-NL/showcase/PK 7 locale/pl-PL/PK 7locale/pl-PL/showcase/PK 7 locale/pt-BR/PK 7locale/pt-BR/showcase/PK 7 locale/ru-RU/PK 7locale/ru-RU/showcase/PK 7 locale/sk-SK/PK 7locale/sk-SK/showcase/PK 7 locale/zh-CN/PK 7locale/zh-CN/showcase/PK 7 locale/zh-TW/PK 7locale/zh-TW/showcase/PK 7skin/PK 7 skin/classic/PK 7skin/classic/showcase/PK 7!skin/classic/showcase/background/PK 7$$content/bindings/tabbar.xml %tabBrowserDTD; %globalDTD; %overlayDTD; ]> = 0; i--) { this._addTabToPopup(tabs[i]); } ]]> document.getElementById("bundle_showcaseoverlay") document.getElementById("bundle_showcaseoverlay") PK 7{҂XXcontent/cache.jsvar showcaseCanvasCounter = 0; // Tab cache function ShowcaseTabCache(b) { this.browser = b; this.thumb = null; b.showcaseCache = this; b.addEventListener("pageshow", this, true); b.addEventListener("resize", this, false); if (ShowcaseCache.updateThumbnailWhenScroll) { b.addEventListener("scroll", this, true); } }; ShowcaseTabCache.prototype = { QueryInterface: function(aIID) { if (aIID.equals(Components.interfaces.nsITimerCallback) || aIID.equals(Components.interfaces.nsISupportsWeakReference) || aIID.equals(Components.interfaces.nsISupports)) return this; throw Components.results.NS_NOINTERFACE; }, makeThumbnail: function () { if (this.browser.currentURI != null && this.browser.currentURI.spec == "about:blank") { this.thumb = null; return; } if (!ShowcaseCache.activateCache) { this.thumb = null; return; } var cacheWidth, cacheHeight; var targetWidth, targetHeight; if (ShowcaseCache.detectImage && (this.browser.contentDocument instanceof ImageDocument)) { var img = this.browser.contentDocument.imageRequest.decoderObserver; targetWidth = img.width; targetHeight = img.height; } else { targetWidth = this.browser.contentWindow.innerWidth; targetHeight = this.browser.contentWindow.innerHeight; } if (targetWidth > targetHeight) { if (targetWidth > ShowcaseCache.cacheSize) { cacheWidth = ShowcaseCache.cacheSize; cacheHeight = Math.ceil(ShowcaseCache.cacheSize * targetHeight / targetWidth); } else { cacheWidth = targetWidth; cacheHeight = targetHeight; } } else { if (targetHeight > ShowcaseCache.cacheSize) { cacheHeight = ShowcaseCache.cacheSize; cacheWidth = Math.ceil(ShowcaseCache.cacheSize * targetWidth / targetHeight); } else { cacheWidth = targetWidth; cacheHeight = targetHeight; } } if (this.thumb == null) { this.createThumbnail(); } this.thumb.width = cacheWidth; this.thumb.height = cacheHeight; if (ShowcaseCache.currentShowcases.length < 1) { window.setTimeout(drawThumbnail, 0, this); } }, createThumbnail: function() { this.thumb = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas"); this.thumb.id = "cachecanvas" + showcaseCanvasCounter++; }, handleEvent: function (e) { if (ShowcaseCache.currentShowcases.length > 0) return; if (e.type == "scroll") { if (!this._scrollTimer) { this._scrollTimer = Components.classes["@mozilla.org/timer;1"].createInstance(Components.interfaces.nsITimer); } this._scrollTimer.cancel(); this._scrollTimer.initWithCallback(this, 300, Components.interfaces.nsITimer.TYPE_ONE_SHOT); this.waitingRepaint = true; } else { this.makeThumbnail(); } }, notify: function(timer) { this.makeThumbnail(); this.waitingRepaint = false; }, unload: function() { if (this.browser) { this.browser.removeEventListener("pageshow", this, true); this.browser.removeEventListener("resize", this, false); if (ShowcaseCache.updateThumbnailWhenScroll) { this.browser.removeEventListener("scroll", this, true); } this.browser.showcaseCache = null; } this.browser = null; if (this._scrollTimer) { this._scrollTimer.cancel(); this._scrollTimer = undefined; } this.thumb = null; } }; function drawThumbnail(target) { if (target.drawingThumbnail) return; var currentWebBrowserPrint = target.browser.contentWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor) .getInterface(Components.interfaces.nsIWebBrowserPrint); if (currentWebBrowserPrint.doingPrint || currentWebBrowserPrint.doingPrintPreview) return; target.drawingThumbnail = true; try { var ctx = target.thumb.getContext("2d"); ctx.clearRect(0, 0, target.thumb.width, target.thumb.height); if (ShowcaseCache.detectImage && (target.browser.contentDocument instanceof ImageDocument)) { var img = target.browser.contentDocument.imageRequest.decoderObserver; ctx.drawImage(img, 0, 0, target.thumb.width, target.thumb.height); } else { ctx.save(); ctx.scale(target.thumb.width/target.browser.contentWindow.innerWidth, target.thumb.height/target.browser.contentWindow.innerHeight); ctx.drawWindow(target.browser.contentWindow, target.browser.contentWindow.scrollX, target.browser.contentWindow.scrollY, target.browser.contentWindow.innerWidth, target.browser.contentWindow.innerHeight, "rgb(255,255,255)"); ctx.restore(); } } catch (e) { //Paint thumbnail failed, probably because the thumbnail disappeared. Fail silently. } target.drawingThumbnail = false; } var ShowcaseCache = { prefs: null, activateCache: false, cacheSize: 0, isCaching: false, detectImage: false, enhancedTabBar: false, allTabsButtonMode: -1, updateThumbnailWhenScroll: false, currentShowcases: null, QueryInterface: function (aIID) { if (aIID.equals(Components.interfaces.nsIPrefBranchInternal) || aIID.equals(Components.interfaces.nsISupportsWeakReference) || aIID.equals(Components.interfaces.nsISupports)) return this; throw Components.results.NS_NOINTERFACE; }, observe: function (aSubject, aTopic, aData) { if (aTopic != "nsPref:changed") return; switch (aData) { case "extensions.showcase.cacheSize": ShowcaseCache.cacheSize = ShowcaseCache.prefs.getIntPref("cacheSize"); break; case "extensions.showcase.activateCache": ShowcaseCache.activateCache = ShowcaseCache.prefs.getBoolPref("activateCache"); if (ShowcaseCache.activateCache && !ShowcaseCache.isCaching) { ShowcaseCache.enableCaching(); } else if (!ShowcaseCache.activateCache && ShowcaseCache.isCaching) { ShowcaseCache.disableCaching(); } break; case "extensions.showcase.detectImage": ShowcaseCache.detectImage = ShowcaseCache.prefs.getBoolPref("detectImage"); // Update image thumbnails if necessary if (ShowcaseCache.isCaching) { var totalTabs = getBrowser().tabContainer.childNodes.length; for (var d=0; d (targetScrollBox._scrollbox.boxObject.width + xPos.value)) && (currentTab >= 0)) { currentX -= tabs[currentTab].boxObject.width; currentTab--; } return (tabs.length - 1 - currentTab); } else { var height = { }; targetScrollBox.scrollBoxObject.getScrolledSize({}, height); var yPos = { } targetScrollBox.scrollBoxObject.getPosition({}, yPos); var currentY = height.value; var currentTab = tabs.length - 1; while ((currentY > (targetScrollBox._scrollbox.boxObject.height + yPos.value)) && (currentTab >= 0)) { currentY = tabs[currentTab].boxObject.height; currentTab--; } return (tabs.length - 1 - currentTab); } }, onLoad: function() { ShowcaseCache.currentShowcases = new Array(); ShowcaseCache.prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("extensions.showcase."); ShowcaseCache.activateCache = ShowcaseCache.prefs.getBoolPref("activateCache"); ShowcaseCache.cacheSize = ShowcaseCache.prefs.getIntPref("cacheSize"); ShowcaseCache.detectImage = ShowcaseCache.prefs.getBoolPref("detectImage"); ShowcaseCache.updateThumbnailWhenScroll = ShowcaseCache.prefs.getBoolPref("updateThumbnailWhenScroll"); ShowcaseCache.enhancedTabBar = ShowcaseCache.prefs.getBoolPref("enhancedTabBar"); ShowcaseCache.allTabsButtonMode = ShowcaseCache.prefs.getIntPref("allTabsButtonMode"); Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch2).addObserver("extensions.showcase.", this, false); if (ShowcaseCache.activateCache) { ShowcaseCache.enableCaching(); } // Catch event if necessary if (ShowcaseCache.enhancedTabBar && getBrowser().mTabContainer.mAllTabsPopup) { ShowcaseCache.registerEnhancedTabBar(); } setTimeout(function() {ShowcaseCache.showWelcomeScreenIfNeeded() }, 400); }, showWelcomeScreenIfNeeded: function() { if (ShowcaseCache.prefs.getBoolPref("firstRunRedirection")) { var currentVersion = ShowcaseCache.prefs.getCharPref("currentVersion"); if (currentVersion != "0.9.4.5") { ShowcaseCache.prefs.setCharPref("currentVersion", "0.9.4.5"); var targetURL; if (currentVersion == "none") { targetURL = "http://showcase.uworks.net/welcome.html"; } else { targetURL = "http://showcase.uworks.net/updated.html"; } var newTab = getBrowser().addTab(targetURL); getBrowser().selectedTab = newTab; } } }, catchAllTabsPopupShowing: function(ev) { switch (ShowcaseCache.allTabsButtonMode) { case 0: setTimeout(showShowcase, 0, false, false); break; case 1: setTimeout(showShowcase, 0, true, false); break; case 2: setTimeout(showShowcase, 0, false, true); break; case 3: setTimeout(showShowcase, 0, true, true); break; case 4: setTimeout(toggleSidebar, 0, 'viewShowcaseSidebar'); break; case 5: setTimeout(toggleSidebar, 0, 'viewShowcaseThisWindowSidebar'); break; } if (getBrowser().mTabContainer.mAllTabsPopup._onHidingAllTabsPopup) getBrowser().mTabContainer.mAllTabsPopup._onHidingAllTabsPopup(); ev.preventDefault(); return false; }, enableCaching: function() { if (ShowcaseCache.isCaching) return; if (typeof BrowserOpenAddonsMgr == "function") { getBrowser().tabContainer.addEventListener("TabOpen", ShowcaseCache.firefox2CatchNewTab, false); getBrowser().tabContainer.addEventListener("TabClose", ShowcaseCache.firefox2CatchDestroyTab, false); } else { getBrowser().mPanelContainer.addEventListener("DOMNodeInserted", ShowcaseCache.catchNewTab, false); getBrowser().mPanelContainer.addEventListener("DOMNodeRemoved", ShowcaseCache.catchDestroyTab, false); } var totalTabs = getBrowser().tabContainer.childNodes.length; for (var d=0; d -1) { ShowcaseCache.currentShowcases.splice(targetIndex, 1); } } }; window.addEventListener("load", function(e) { ShowcaseCache.onLoad(); }, false); window.addEventListener("unload", function(e) { ShowcaseCache.onUnload(); }, false); function debugLog(msg) { var consoleService = Components.classes["@mozilla.org/consoleservice;1"] .getService(Components.interfaces.nsIConsoleService); consoleService.logStringMessage(msg); } PK 7K`!content/settings/pref-advanced.jsfunction advancedPrefInit() { activateCacheChanged(); enhancedTabBarChanged(); } function activateCacheChanged() { var activateCacheCheckbox = document.getElementById("activateCache"); document.getElementById("cacheSize").disabled = !activateCacheCheckbox.checked; document.getElementById("cacheSizeLabel").disabled = !activateCacheCheckbox.checked; document.getElementById("cacheSizePixelsLabel").disabled = !activateCacheCheckbox.checked; } function enhancedTabBarChanged() { var enhancedTabBarCheckbox = document.getElementById("enhancedTabBar"); document.getElementById("allTabsButtonModeLabel").disabled = !enhancedTabBarCheckbox.checked; document.getElementById("allTabsButtonMode").disabled = !enhancedTabBarCheckbox.checked; }PK 7`"content/settings/pref-advanced.xul %dialogDTD; %tabBrowserDTD; %overlayDTD; ]>