diff options
Diffstat (limited to 'bandwagon/content/ui/bindings/bandwagon.xml')
-rw-r--r-- | bandwagon/content/ui/bindings/bandwagon.xml | 177 |
1 files changed, 62 insertions, 115 deletions
diff --git a/bandwagon/content/ui/bindings/bandwagon.xml b/bandwagon/content/ui/bindings/bandwagon.xml index 3a3a628..90a0e73 100644 --- a/bandwagon/content/ui/bindings/bandwagon.xml +++ b/bandwagon/content/ui/bindings/bandwagon.xml @@ -48,18 +48,15 @@ <resources> <stylesheet src="chrome://bandwagon/skin/extensionsOverlay.css"/> - <stylesheet src="chrome://bandwagon/skin/extensionsOverlayIcons.css"/> </resources> - <content orient="vertical"> - <xul:vbox flex="1"> <!-- Needed to constrain the list so that it does not horizontally scroll - Bug 488403--> - <xul:hbox align="center"> - <xul:image anonid="star" src="chrome://bandwagon/skin/images/star.png" style="width: 1em; height: 1em;" collapsed="true"/> - <xul:label anonid="name" crop="center" flex="1"/> - <xul:label anonid="unread" collapsed="true"/> - <xul:image anonid="localautopub" class="autopubimg" collapsed="true"/> - </xul:hbox> - </xul:vbox> + <content> + <xul:hbox flex="1" align="center"> + <xul:image anonid="star" src="chrome://bandwagon/skin/images/star.png" style="width: 1em; height: 1em;" collapsed="true"/> + <xul:label anonid="name"/> + <xul:label anonid="unread" collapsed="true"/> + <xul:image anonid="localautopub" src="chrome://bandwagon/skin/images/localautopub.png" style="width: 1em; height: 1em;" collapsed="true"/> + </xul:hbox> </content> <implementation> @@ -137,7 +134,6 @@ <resources> <stylesheet src="chrome://bandwagon/skin/extensionsOverlay.css"/> - <stylesheet src="chrome://bandwagon/skin/extensionsOverlayIcons.css"/> </resources> <content> @@ -154,10 +150,7 @@ <xul:hbox flex="1"> <xul:label anonid="name" class="name"/> <xul:spacer flex="1"/> - <xul:hbox align="center"> - <xul:image anonid="commenticon" class="comment-icon"/> - <xul:label anonid="dateadded"/> - </xul:hbox> + <xul:label anonid="dateadded"/> </xul:hbox> <xul:label anonid="summary" crop="end"/> </xul:vbox> @@ -251,6 +244,13 @@ </setter> </property> + <!-- + <property name="category" + onget="return (document.getAnonymousElementByAttribute(this, 'anonid', 'category')?document.getAnonymousElementByAttribute(this, 'anonid', 'category').value:'')" + onset="if (document.getAnonymousElementByAttribute(this, 'anonid', 'category')) document.getAnonymousElementByAttribute(this, 'anonid', 'category').value = this._stringBundle.getFormattedString('bandwagon.addon.category', [val])" + /> + --> + <property name="read" onget="return this.getAttribute('read')" onset="this.setAttribute('read', val);" @@ -292,7 +292,7 @@ sbString = "bandwagon.addon.added.week"; sbVal = Math.floor(diff/60/60/24/7); } - else if (diff < 60 * 60 * 24 * 365) + else if (diff < 60 * 60 * 24 * 356) { sbString = "bandwagon.addon.added.month"; sbVal = Math.floor(diff/60/60/24/30); @@ -300,12 +300,23 @@ else { sbString = "bandwagon.addon.added.year"; - sbVal = Math.floor(diff/60/60/24/365); + sbVal = Math.floor(diff/60/60/24/356); } - Components.utils.import("resource://gre/modules/PluralForm.jsm"); - let [get, numForms] = PluralForm.makeGetter(this._stringBundle.getString("bandwagon.addon.pluralRule")); - var datestr = get(sbVal, this._stringBundle.getFormattedString(sbString, [sbVal])); + var datestr = ""; + + if (sbVal == 0) + { + datestr = this._stringBundle.getString(sbString); + } + else if (sbVal == 1) + { + datestr = this._stringBundle.getString(sbString); + } + else + { + datestr = this._stringBundle.getFormattedString(sbString + "s", [sbVal]); + } document.getAnonymousElementByAttribute(this, 'anonid', 'dateadded').value = datestr; ]]> @@ -313,24 +324,12 @@ </property> <property name="comment" - onget="return (document.getAnonymousElementByAttribute(this, 'anonid', 'commentdesc')?document.getAnonymousElementByAttribute(this, 'anonid', 'commentdesc').textContent : '')" + onget="return (document.getAnonymousElementByAttribute(this, 'anonid', 'commentdesc')?document.getAnonymousElementByAttribute(this, 'anonid', 'commentdesc').value:'')" > <setter> <![CDATA[ - if (document.getAnonymousElementByAttribute(this, 'anonid', 'commentdesc')) - document.getAnonymousElementByAttribute(this, 'anonid', 'commentdesc').textContent = this._stringBundle.getFormattedString('bandwagon.addon.comment.description', [val.comment]); - if (document.getAnonymousElementByAttribute(this, 'anonid', 'commentauthor')) - document.getAnonymousElementByAttribute(this, 'anonid', 'commentauthor').value = this._stringBundle.getFormattedString('bandwagon.addon.comment.author', [val.author]); - ]]> - </setter> - </property> - - <property name="addedBy" - onget="return (document.getAnonymousElementByAttribute(this, 'anonid', 'addedby')?document.getAnonymousElementByAttribute(this, 'anonid', 'addedby').value:'')" - > - <setter> - <![CDATA[ - if (document.getAnonymousElementByAttribute(this, 'anonid', 'addedby')) document.getAnonymousElementByAttribute(this, 'anonid', 'addedby').value = this._stringBundle.getFormattedString('bandwagon.addon.addedby', [val]); + if (document.getAnonymousElementByAttribute(this, 'anonid', 'commentdesc')) document.getAnonymousElementByAttribute(this, 'anonid', 'commentdesc').firstChild.nodeValue = this._stringBundle.getFormattedString('bandwagon.addon.comment.description', [val.comment]); + if (document.getAnonymousElementByAttribute(this, 'anonid', 'commentauthor')) document.getAnonymousElementByAttribute(this, 'anonid', 'commentauthor').value = this._stringBundle.getFormattedString('bandwagon.addon.comment.author', [val.author]); ]]> </setter> </property> @@ -347,47 +346,31 @@ this.iconURL = addon.icon; this.thumbnailURL = addon.thumbnail; this.authors = addon.authors; + //this.category = (addon.category?addon.category:"Unknown"); this.dateAdded = addon.dateAdded; this.read = addon.read; if (addon.comments.length > 0) { - if (addon.comments[0].comment.match(/\w/)) - { - this.comment = addon.comments[0]; - } - - this.addedBy = addon.comments[0].author; - if (addon.comments[0].comment == "") // it seems each addon will have an empty comment if none was made - { - document.getAnonymousElementByAttribute(this, 'anonid', 'commenticon').setAttribute("collapsed", true); - if (document.getAnonymousElementByAttribute(this, 'anonid', 'commentbox')) // expanded only - document.getAnonymousElementByAttribute(this, 'anonid', 'commentbox').setAttribute("collapsed", true); - } + this.comment = addon.comments[0]; } else { - document.getAnonymousElementByAttribute(this, 'anonid', 'commenticon').setAttribute("collapsed", true); - if (document.getAnonymousElementByAttribute(this, 'anonid', 'commentbox')) // expanded only - document.getAnonymousElementByAttribute(this, 'anonid', 'commentbox').setAttribute("collapsed", true); + if (document.getAnonymousElementByAttribute(this, 'anonid', 'commentdesc')) + { + document.getAnonymousElementByAttribute(this, 'anonid', 'commentdesc').style.collapsed = true; + document.getAnonymousElementByAttribute(this, 'anonid', 'commentauthor').style.collapsed = true; + } } - this.invalidateCompatibilityCheck(); - this.invalidatePublishButton(); - ]]> - </body> - </method> + var canInstall = addon.canInstall(Bandwagon.Util.getHostEnvironmentInfo()); + this.showVersionHelper(canInstall.type, canInstall.requiredVersion); - <method name="invalidateCompatibilityCheck"> - <body> - <![CDATA[ - if (this.addon) + if (document.getAnonymousElementByAttribute(this, 'anonid', 'publish')) { - var canInstall = this.addon.canInstall(Bandwagon.Util.getHostEnvironmentInfo()); - var requiredVersion = Bandwagon.Util.getUserFacingOSName(canInstall.requiredVersion); - - this.showVersionHelper(canInstall.type, requiredVersion); + this.invalidatePublishButton(); } + ]]> </body> </method> @@ -415,13 +398,6 @@ if (document.getAnonymousElementByAttribute(this, 'anonid', 'addtofirefox') && document.getAnonymousElementByAttribute(this, 'anonid', 'addtofirefoxwarning')) { - var container = document.getAnonymousElementByAttribute(this, 'anonid', 'addtofirefoxwarning'); - - while (container.hasChildNodes()) - { - container.removeChild(container.firstChild); - } - if (type == Bandwagon.Model.Addon.INSTALL_YES) { document.getAnonymousElementByAttribute(this, 'anonid', 'addtofirefox').disabled = false; @@ -429,34 +405,17 @@ } else { - if (type == Bandwagon.Model.Addon.INSTALL_NO_IS_EXPERIMENTAL) - { - var msg; - - try - { - msg = this._stringBundle.getString("bandwagon.addon.isexperimental"); - } - catch (e) - { - msg = this._stringBundle.getString("bandwagon.addon.olderversionsoffirefox"); - } - - document.getAnonymousElementByAttribute(this, 'anonid', 'addtofirefoxwarning').appendChild( - document.createTextNode(msg)); - } - else if (type == Bandwagon.Model.Addon.INSTALL_NO_ADDON_IS_FOR_OLDER_VERSION) + if (type == Bandwagon.Model.Addon.INSTALL_NO_ADDON_IS_FOR_OLDER_VERSION) { document.getAnonymousElementByAttribute(this, 'anonid', 'addtofirefoxwarning').appendChild( document.createTextNode(this._stringBundle.getString("bandwagon.addon.olderversionsoffirefox"))); } else if (type == Bandwagon.Model.Addon.INSTALL_NO_UPGRADE_TO_USE_THIS_VERSION) { - var atffwl = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "xul:label"); - atffwl.className = "text-link"; - atffwl.setAttribute("value", this._stringBundle.getFormattedString("bandwagon.addon.upgradetofirefoxn1", [version])); + var atffwl = document.getAnonymousElementByAttribute(this, 'anonid', 'addtofirefoxwarninglink'); + atffwl.value = this._stringBundle.getFormattedString("bandwagon.addon.upgradetofirefoxn1", [version]); + atffwl.collapsed = false; atffwl.addEventListener("click", function() { Bandwagon.Controller.CollectionsPane.doUpgradeToFirefoxN(version); }, true); - document.getAnonymousElementByAttribute(this, 'anonid', 'addtofirefoxwarning').appendChild(atffwl); document.getAnonymousElementByAttribute(this, 'anonid', 'addtofirefoxwarning').appendChild( document.createTextNode(this._stringBundle.getString("bandwagon.addon.upgradetofirefoxn2"))); @@ -466,9 +425,9 @@ document.getAnonymousElementByAttribute(this, 'anonid', 'addtofirefoxwarning').appendChild( document.createTextNode(this._stringBundle.getFormattedString("bandwagon.addon.requiresfirefoxbeta1", [version]))); - var atffwl = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "xul:label"); - atffwl.className = "text-link"; - atffwl.setAttribute("value", this._stringBundle.getFormattedString("bandwagon.addon.requiresfirefoxbeta2", [version])); + var atffwl = document.getAnonymousElementByAttribute(this, 'anonid', 'addtofirefoxwarninglink'); + atffwl.value = this._stringBundle.getFormattedString("bandwagon.addon.requiresfirefoxbeta2", [version]); + atffwl.collapsed = false; atffwl.addEventListener("click", function() { Bandwagon.Controller.CollectionsPane.doDownloadFirefoxNBeta(version); }, true); document.getAnonymousElementByAttribute(this, 'anonid', 'addtofirefoxwarning').appendChild(atffwl); @@ -481,13 +440,11 @@ document.getAnonymousElementByAttribute(this, 'anonid', 'addtofirefoxwarning').collapsed = false; - var isExtensionsCheckCompatibility = Bandwagon.Preferences.getGlobalPreference("extensions.checkCompatibility", true); + var isExtensionsCheckCompatibility = Bandwagon.Preferences.getGlobalPreference("extensions.checkCompatibility"); var isAllowIncompatibleInstall = Bandwagon.Preferences.getPreference("allow.incompatible.install"); if ((isExtensionsCheckCompatibility != null && isExtensionsCheckCompatibility == false) - && (isAllowIncompatibleInstall != null && isAllowIncompatibleInstall == true) - && (this.addon.getInstaller(Bandwagon.Util.getHostEnvironmentInfo().os)) - ) + && (isAllowIncompatibleInstall != null && isAllowIncompatibleInstall == true)) { document.getAnonymousElementByAttribute(this, 'anonid', 'addtofirefox').disabled = false; } @@ -559,32 +516,23 @@ <xul:vbox flex="1" class="addonTextBox"> <xul:hbox flex="1"> <xul:vbox flex="1"> - <xul:hbox flex="1" align="center"> + <xul:hbox flex="1"> <xul:label anonid="name" class="name"/> <xul:spacer flex="1"/> - <xul:vbox align="end"> - <xul:hbox align="center"> - <xul:image anonid="commenticon" class="comment-icon"/> - <xul:label anonid="dateadded"/> - </xul:hbox> - <xul:label anonid="addedby"/> - </xul:vbox> + <xul:label anonid="dateadded"/> </xul:hbox> <xul:hbox anonid="byline" flex="1"> <xul:label anonid="authors"/> <xul:spacer flex="1"/> + <!--<xul:label anonid="category"/>--> </xul:hbox> + <xul:label anonid="commentauthor" flex="1"/> + <xul:description anonid="commentdesc"> </xul:description> </xul:vbox> </xul:hbox> - <xul:vbox anonid="commentbox" flex="1" class="comments unindent"> - <xul:hbox align="center"> - <xul:label anonid="commentauthor" flex="1"/> - </xul:hbox> - <xul:description anonid="commentdesc" flex="1"/> - </xul:vbox> <xul:hbox align="stretch" anonid="fulldesc" - class="collection-item-details unindent" + class="collection-item-details" flex="1"> <xul:vbox pack="start"> <xul:hbox anonid="bandwagonThumbnailContainer" @@ -604,6 +552,7 @@ <xul:button anonid="addtofirefox" label="&addon.addtofirefox;" oncommand="Bandwagon.Controller.CollectionsPane.doAddToFirefox()"/> </xul:hbox> <xul:description anonid="addtofirefoxwarning" class="right"> + <xul:label anonid="addtofirefoxwarninglink" class="text-link" collapsed="true"/> </xul:description> </xul:vbox> </xul:hbox> @@ -632,7 +581,6 @@ <resources> <stylesheet src="chrome://bandwagon/skin/extensionsOverlay.css"/> - <stylesheet src="chrome://bandwagon/skin/extensionsOverlayIcons.css"/> </resources> <content> @@ -743,7 +691,6 @@ if (collection.__containsCurrentlySelectedExtension) { - elemWritableCollection.setAttribute("type", "checkbox"); elemWritableCollection.setAttribute("checked", "true"); elemWritableCollection.setAttribute("autocheck", "false"); elemWritableCollection.addEventListener("command", callbackRemove, true); |