Skip to content

Commit

Permalink
Merge branch 'release-1.12.32'
Browse files Browse the repository at this point in the history
* release-1.12.32:
  Update version info.
  core: add unicodeToUtf8() and utf8ToUnicode()
  core: organize sbCommonUtils methods
  capture: fix wrong charset for frames
  prefs: tab icons now use individual images
  prefs: remove unused prefs
  prefs: fix a potential error for getPref
  lang: replace &#...; and &#x...; entities with normal chars.
  core: centralize and optimize formatFileSize()
  core: simplify unneeded get
  core: separate console to console.jsm
  core: separate lang to lang.jsm
  core: separate Shortcut to shortcut.jsm
  core: improve the structure of core classes
  • Loading branch information
danny0838 committed Jul 5, 2016
2 parents cc835ca + 9ce32c8 commit 6cbf563
Show file tree
Hide file tree
Showing 21 changed files with 663 additions and 559 deletions.
9 changes: 9 additions & 0 deletions RELEASE.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
Scrapbook X 1.12.32
----------------

- FIXED: Frames may be captured with wrong charset if "Save with UTF-8 encoding" is not checked.
- FIXED: A potential error for getting preference setting.
- UPDATE: Improved the presentation format of file size.
- UPDATE: Internal code optimization.


Scrapbook X 1.12.31
----------------

Expand Down
6 changes: 3 additions & 3 deletions chrome/content/scrapbook/calculate.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var sbCalcService = {
sbDataSource.getProperty(res, "title"),
icon,
0,
sbPropService.formatFileSize(0),
sbCommonUtils.formatFileSize(0),
false,
]);
}
Expand Down Expand Up @@ -69,7 +69,7 @@ var sbCalcService = {
sbDataSource.getProperty(res, "title"),
icon,
bytes,
sbPropService.formatFileSize(bytes),
sbCommonUtils.formatFileSize(bytes),
valid,
]);
if ( !valid ) this.invalidCount++;
Expand All @@ -85,7 +85,7 @@ var sbCalcService = {
this.initTree();
this.STATUS.label = "";
this.PROGRESS.hidden = true;
document.getElementById("sbCalcTotalSize").value = sbCommonUtils.lang("property", "ITEMS_COUNT", [sbPropService.formatFileSize(this.grandSum), this.count, this.total]);
document.getElementById("sbCalcTotalSize").value = sbCommonUtils.lang("property", "ITEMS_COUNT", [sbCommonUtils.formatFileSize(this.grandSum), this.count, this.total]);
document.getElementById("sbCalcDiagnosis").value = ( this.invalidCount == 0 ) ? sbCommonUtils.lang("property", "DIAGNOSIS_OK") : sbCommonUtils.lang("property", "DIAGNOSIS_NG", [this.invalidCount]);
this.checkDoubleEntries();
},
Expand Down
15 changes: 13 additions & 2 deletions chrome/content/scrapbook/common.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
Components.utils.import("resource://scrapbook-modules/common.jsm");
Components.utils.import("resource://scrapbook-modules/datasource.jsm");
/********************************************************************
*
* Shared classes for most scripts.
*
* @public {class} sbCommonUtils
* @public {class} sbDataSource
* @public {class} Shortcut
*
*******************************************************************/

const { sbCommonUtils } = Components.utils.import("resource://scrapbook-modules/common.jsm", {});
const { sbDataSource } = Components.utils.import("resource://scrapbook-modules/datasource.jsm", {});
const { Shortcut } = Components.utils.import("resource://scrapbook-modules/shortcut.jsm", {});
23 changes: 1 addition & 22 deletions chrome/content/scrapbook/property.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ var sbPropService = {

delayedInit: function() {
var sizeCount = this.getTotalFileSize(this.id);
document.getElementById("sbPropSize").value = sbCommonUtils.lang("property", "FILES_COUNT", [sbPropService.formatFileSize(sizeCount[0]), sizeCount[1], sizeCount[2]]);
document.getElementById("sbPropSize").value = sbCommonUtils.lang("property", "FILES_COUNT", [sbCommonUtils.formatFileSize(sizeCount[0]), sizeCount[1], sizeCount[2]]);
},

accept: function() {
Expand Down Expand Up @@ -225,27 +225,6 @@ var sbPropService = {
return [totalSize, totalFile, totalDir];
},

formatFileSize: function(aBytes) {
if ( aBytes > 1000 * 1000 ) {
return this.divideBy100( Math.round( aBytes / 1024 / 1024 * 100 ) ) + " MB";
} else if ( aBytes == 0 ) {
return "0 KB";
} else {
var kbytes = Math.round( aBytes / 1024 );
return (kbytes == 0 ? 1 : kbytes) + " KB";
}
},

divideBy100: function(aInt) {
if ( aInt % 100 == 0 ) {
return aInt / 100 + ".00";
} else if ( aInt % 10 == 0 ) {
return aInt / 100 + "0";
} else {
return aInt / 100;
}
},

};


Expand Down
12 changes: 6 additions & 6 deletions chrome/content/scrapbook/saver.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ var sbContentSaver = {

captureWindow: function(aRootWindow, aIsPartial, aShowDetail, aResName, aResIndex, aPresetData, aContext, aTitle) {
this.init(aPresetData);
this.item.chars = aRootWindow.document.characterSet;
this.item.chars = this.option["forceUtf8"] ? "UTF-8" : aRootWindow.document.characterSet;
this.item.source = aRootWindow.location.href;
//Favicon der angezeigten Seite bestimmen (Unterscheidung zwischen FF2 und FF3 notwendig!)
if ( "gBrowser" in window && aRootWindow == gBrowser.contentWindow ) {
Expand Down Expand Up @@ -152,14 +152,15 @@ var sbContentSaver = {

saveDocumentInternal: function(aDocument, aFileKey) {
var captureType = "";
var charset = this.option["forceUtf8"] ? "UTF-8" : aDocument.characterSet;
var contentType = aDocument.contentType;
if ( ["text/html", "application/xhtml+xml"].indexOf(contentType) < 0 ) {
if ( !(aDocument.documentElement.nodeName.toUpperCase() == "HTML" && this.option["asHtml"]) ) {
captureType = "file";
}
}
if ( captureType ) {
var newLeafName = this.saveFileInternal(aDocument.location.href, aFileKey, captureType, aDocument.characterSet);
var newLeafName = this.saveFileInternal(aDocument.location.href, aFileKey, captureType, charset);
return newLeafName;
}

Expand Down Expand Up @@ -332,7 +333,6 @@ var sbContentSaver = {
// change the charset to UTF-8
// also change the meta tag; generate one if none found
if ( this.option["forceUtf8"] ) {
this.item.chars = "UTF-8";
var metas = rootNode.getElementsByTagName("meta"), meta, hasmeta = false;
for (var i=0, len=metas.length; i<len; ++i) {
meta = metas[i];
Expand All @@ -348,7 +348,7 @@ var sbContentSaver = {
}
if (!hasmeta) {
var metaNode = aDocument.createElement("meta");
metaNode.setAttribute("charset", this.item.chars);
metaNode.setAttribute("charset", "UTF-8");
headNode.insertBefore(aDocument.createTextNode("\n"), headNode.firstChild);
headNode.insertBefore(metaNode, headNode.firstChild);
headNode.insertBefore(aDocument.createTextNode("\n"), headNode.firstChild);
Expand All @@ -363,11 +363,11 @@ var sbContentSaver = {
var myHTMLFile = this.contentDir.clone();
myHTMLFile.append(myHTMLFileName);
}
sbCommonUtils.writeFile(myHTMLFile, myHTML, this.item.chars);
sbCommonUtils.writeFile(myHTMLFile, myHTML, charset);
if ( myCSS ) {
var myCSSFile = this.contentDir.clone();
myCSSFile.append(myCSSFileName);
sbCommonUtils.writeFile(myCSSFile, myCSS, this.item.chars);
sbCommonUtils.writeFile(myCSSFile, myCSS, charset);
}
return myHTMLFile.leafName;
},
Expand Down
10 changes: 5 additions & 5 deletions chrome/locale/hu-HU/scrapbook/templateHelp.dtd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!ENTITY sb.thelp.dir "ltr">
<!ENTITY sb.thelp.title "Dosszi&#233; sablon HTML s&#250;g&#243;">
<!ENTITY sb.thelp.tags "K&#233;t speci&#225;lis k&#243;delem">
<!ENTITY sb.thelp.tag1 "A jegyzet c&#237;me (els&#337; sora)">
<!ENTITY sb.thelp.tag2 "A jegyzet tartalma (a m&#225;sodik vagy k&#233;s&#337;bbi sor)">
<!ENTITY sb.thelp.preset "El&#337;re be&#225;ll&#237;tott sablon">
<!ENTITY sb.thelp.title "Dosszié sablon HTML súgó">
<!ENTITY sb.thelp.tags "Két speciális kódelem">
<!ENTITY sb.thelp.tag1 "A jegyzet címe (első sora)">
<!ENTITY sb.thelp.tag2 "A jegyzet tartalma (a második vagy későbbi sor)">
<!ENTITY sb.thelp.preset "Előre beállított sablon">
16 changes: 6 additions & 10 deletions chrome/skin/classic/scrapbook/prefs.css
Original file line number Diff line number Diff line change
@@ -1,31 +1,27 @@
/* ::::: Options ::::: */

radio[pane] {
list-style-image: url("chrome://scrapbook/skin/prefs.png");
}

radio[pane="mainPane"] {
-moz-image-region: rect(0px, 32px, 32px, 0px)
list-style-image: url("chrome://scrapbook/skin/prefs_main.png");
}

radio[pane="keysPane"] {
-moz-image-region: rect(0px, 64px, 32px, 32px)
list-style-image: url("chrome://scrapbook/skin/prefs_keys.png");
}

radio[pane="tabsPane"] {
-moz-image-region: rect(0px, 96px, 32px, 64px)
list-style-image: url("chrome://scrapbook/skin/prefs_tabs.png");
}

radio[pane="editPane"] {
-moz-image-region: rect(0px, 128px, 32px, 96px)
list-style-image: url("chrome://scrapbook/skin/prefs_edit.png");
}

radio[pane="organizePane"] {
-moz-image-region: rect(0px, 160px, 32px, 128px)
list-style-image: url("chrome://scrapbook/skin/prefs_organize.png");
}

radio[pane="advancedPane"] {
-moz-image-region: rect(0px, 192px, 32px, 160px)
list-style-image: url("chrome://scrapbook/skin/prefs_advanced.png");
}

prefpane > checkbox,
Expand Down
Binary file removed chrome/skin/classic/scrapbook/prefs.png
Binary file not shown.
Binary file added chrome/skin/classic/scrapbook/prefs_advanced.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added chrome/skin/classic/scrapbook/prefs_edit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added chrome/skin/classic/scrapbook/prefs_keys.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added chrome/skin/classic/scrapbook/prefs_main.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added chrome/skin/classic/scrapbook/prefs_organize.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added chrome/skin/classic/scrapbook/prefs_tabs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 0 additions & 2 deletions defaults/preferences/scrapbook-prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ pref("extensions.scrapbook.multibook.enabled", false);
pref("extensions.scrapbook.edit.autoEditNoteX", true);
pref("extensions.scrapbook.edit.autoEditNoteX.active", true);
pref("extensions.scrapbook.edit.insertDateFormat", "%Y-%m-%d %H:%M:%S");
pref("extensions.scrapbook.fileViewer.default", true);
pref("extensions.scrapbook.fileViewer.path", "");
pref("extensions.scrapbook.tree.unshift", false);
pref("extensions.scrapbook.tree.autoCollapse", false);
pref("extensions.scrapbook.confirmDelete", true);
Expand Down
2 changes: 1 addition & 1 deletion install.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Description about="urn:mozilla:install-manifest">
<em:id>[email protected]</em:id>
<em:type>2</em:type>
<em:version>1.12.31</em:version>
<em:version>1.12.32</em:version>
<em:unpack>false</em:unpack>
<em:bootstrap>false</em:bootstrap>
<em:multiprocessCompatible>false</em:multiprocessCompatible>
Expand Down
Loading

0 comments on commit 6cbf563

Please sign in to comment.