Skip to content

Commit

Permalink
Merge branch 'release-1.13.0b4'
Browse files Browse the repository at this point in the history
* release-1.13.0b4: (23 commits)
  Update version info.
  doc: fixed typos in previous release notes
  lang: fix zh-TW localization
  combine: add alt+up/down to move item
  combine: add delete key for deletion
  combine: auto scroll and keep focus to the listbox when moving a item
  combine: auto select another item when deleting an item
  combine: code clean-up and optimization
  capture: make sbpCaptureProgress smaller
  capture: use simplified dialog for a 1-url capture
  capture: auto start if link/multiple/capture-again(-deep) has only 1 url
  capture: merge sbpCapture.css into capture.css
  ui: add menu icon for fulltext search result locate
  ui: add menu icon for sidebar manage and multiple-capture
  ui: add menu icon for sidebar copy and move
  ui: add menu icon for sidebar capture again and internalize
  ui: remove list-view style definitions
  core: improve the comment for sbCommonUtils.readMetaRefresh()
  lang: revise lang merge script in b7de34c
  ...
  • Loading branch information
danny0838 committed Jul 10, 2016
2 parents 9f60e7a + 2ebe5a9 commit 381476b
Show file tree
Hide file tree
Showing 61 changed files with 283 additions and 194 deletions.
18 changes: 15 additions & 3 deletions chrome/content/scrapbook/capture.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,15 @@ function SB_initCapture() {
if ( !("inDepthTimeout" in gOption) ) gOption["inDepthTimeout"] = 0;
sbInvisibleBrowser.init();
sbCaptureTask.init(myURLs);
//Es wird gar nichts gemacht. Der Benutzer muss den Download selbst starten!
sbCaptureTask.seconds = -1;
sbCaptureTask.toggleStartPause(false);
// link: 1 or more item (> 1 only for multiple capture)
// capture-again, capture-again-deep: 1 item
// in-depth: 1 or more item, but it's possible that new items be added if depth > 2
if ( gURLs.length == 1 && gContext != "indepth" ) {
sbCaptureTask.start();
} else {
sbCaptureTask.seconds = -1;
sbCaptureTask.toggleStartPause(false);
}
}


Expand Down Expand Up @@ -191,7 +197,13 @@ var sbCaptureTask = {

init: function(myURLs) {
if ( gContext != "indepth" && myURLs.length == 1 ) {
this.TREE.collapsed = true;
document.getElementById("sbpCaptureProgress").hidden = true;
document.getElementById("sbpChkFilter").hidden = true;
document.getElementById("sbCaptureSkipButton").hidden = true;
} else {
document.getElementById("sbCaptureWindow").style.width = "800px";
document.getElementById("sbCaptureWindow").style.height = "600px";
}
if (!gTitles) gTitles = [];
for ( var i = 0; i < myURLs.length; i++ ) this.add(myURLs[i], 1, gTitles[i]);
Expand Down
5 changes: 2 additions & 3 deletions chrome/content/scrapbook/capture.xul
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

<?xml-stylesheet href="chrome://global/skin/" type="text/css" ?>
<?xml-stylesheet href="chrome://scrapbook/skin/capture.css" type="text/css" ?>
<?xml-stylesheet href="chrome://scrapbook/skin/sbpExtra/sbpCapture.css" type="text/css" ?>

<!DOCTYPE window SYSTEM "chrome://scrapbook/locale/message.dtd">

<window id="sbCaptureWindow"
title="&sb.capture; - ScrapBook"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
style="width: 800px; height: 600px;"
style="width: 360px;"
onload="SB_initCapture();"
onclose="event.preventDefault();sbCaptureTask.abort();"
windowtype="scrapbook">
Expand All @@ -19,7 +18,7 @@
<script type="application/x-javascript" src="chrome://scrapbook/content/capture.js" />

<hbox>
<textbox id="sbpCaptureProgress" readonly="true" width="100"/>
<textbox id="sbpCaptureProgress" readonly="true" width="80"/>
<textbox id="sbCaptureTextbox" readonly="true" flex="1"/>
</hbox>

Expand Down
64 changes: 33 additions & 31 deletions chrome/content/scrapbook/combine.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,62 +196,64 @@ var sbCombineService = {
return newRes;
},

onKeyPress: function(aEvent) {
if ( aEvent.keyCode === aEvent.DOM_VK_DELETE) {
this.deleteItem();
} else if (aEvent.altKey) {
if (aEvent.keyCode === aEvent.DOM_VK_UP) {
this.moveUp();
} else if (aEvent.keyCode === aEvent.DOM_VK_DOWN) {
this.moveDown();
}
}
},

deleteItem: function() {
//Index festhalten
var diIndex = this.LISTBOX.selectedIndex;
var diCount = this.LISTBOX.getRowCount();
var diVorher = "";
var diNachhr = "";
//Eintrag aus Listbox entfernen
if (diIndex < 0) return; // no select
this.LISTBOX.removeItemAt(diIndex);
//this.idList aktualisieren
this.idList.splice(diIndex, 1);
//this.resList aktualisieren
this.resList.splice(diIndex, 1);
//this.parList aktualisieren
this.parList.splice(diIndex, 1);
if (this.LISTBOX.getRowCount() > 0) {
var diNewItem = this.LISTBOX.getItemAtIndex(diIndex) || this.LISTBOX.getItemAtIndex(--diIndex);
this.LISTBOX.ensureElementIsVisible(diNewItem);
this.LISTBOX.selectItem(diNewItem);
this.LISTBOX.focus();
}
this.toggleButtons();
this.updateButtons();
},

moveDown: function() {
var mdIndex = this.LISTBOX.selectedIndex;
//Reihenfolge ändern
var mdPuffer = this.idList[mdIndex];
this.idList[mdIndex] = this.idList[mdIndex+1];
this.idList[mdIndex+1] = mdPuffer;
var mdPuffer = this.resList[mdIndex];
this.resList[mdIndex] = this.resList[mdIndex+1];
this.resList[mdIndex+1] = mdPuffer;
var mdPuffer = this.parList[mdIndex];
this.parList[mdIndex] = this.parList[mdIndex+1];
this.parList[mdIndex+1] = mdPuffer;
if (mdIndex < 0 || mdIndex == this.LISTBOX.getRowCount() - 1) return; // no select, or at bottom
[this.idList[mdIndex], this.idList[mdIndex+1]] = [this.idList[mdIndex+1], this.idList[mdIndex]];
[this.resList[mdIndex], this.resList[mdIndex+1]] = [this.resList[mdIndex+1], this.resList[mdIndex]];
[this.parList[mdIndex], this.parList[mdIndex+1]] = [this.parList[mdIndex+1], this.parList[mdIndex]];
var mdItem = this.LISTBOX.removeItemAt(mdIndex);
var mdNewItem = this.LISTBOX.insertItemAt( mdIndex+1, mdItem.getAttribute("label") );
this.LISTBOX.selectItem(mdNewItem);
mdNewItem.setAttribute("class", "listitem-iconic");
mdNewItem.setAttribute("image", mdItem.getAttribute("image"));
this.LISTBOX.ensureElementIsVisible(mdNewItem);
this.LISTBOX.selectItem(mdNewItem);
this.LISTBOX.focus();
this.toggleButtons();
},

moveUp: function() {
//Index bestimmen
var muIndex = this.LISTBOX.selectedIndex;
//Reihenfolge ändern
var muPuffer = this.idList[muIndex];
this.idList[muIndex] = this.idList[muIndex-1];
this.idList[muIndex-1] = muPuffer;
var muPuffer = this.resList[muIndex];
this.resList[muIndex] = this.resList[muIndex-1];
this.resList[muIndex-1] = muPuffer;
var muPuffer = this.parList[muIndex];
this.parList[muIndex] = this.parList[muIndex-1];
this.parList[muIndex-1] = muPuffer;
if (muIndex <= 0) return; // no select, or at top
[this.idList[muIndex], this.idList[muIndex-1]] = [this.idList[muIndex-1], this.idList[muIndex]];
[this.resList[muIndex], this.resList[muIndex-1]] = [this.resList[muIndex-1], this.resList[muIndex]];
[this.parList[muIndex], this.parList[muIndex-1]] = [this.parList[muIndex-1], this.parList[muIndex]];
var muItem = this.LISTBOX.removeItemAt(muIndex);
var muNewItem = this.LISTBOX.insertItemAt( muIndex-1, muItem.getAttribute("label") );
this.LISTBOX.selectItem(muNewItem);
muNewItem.setAttribute("class", "listitem-iconic");
muNewItem.setAttribute("image", muItem.getAttribute("image"));
this.LISTBOX.ensureElementIsVisible(muNewItem);
this.LISTBOX.selectItem(muNewItem);
this.LISTBOX.focus();
this.toggleButtons();
},

Expand Down
7 changes: 4 additions & 3 deletions chrome/content/scrapbook/combine.xul
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@
ondragover="nsDragAndDrop.dragOver(event,sbCombineService.dropObserver);"
ondragdrop="nsDragAndDrop.drop(event,sbCombineService.dropObserver);"
onclick="sbCombineService.toggleButtons();"
onkeypress="sbCombineService.onKeyPress(event);"
flex="1" style="margin-bottom: 12px;" />
<vbox flex="1">
<button id="sbpUp" disabled="true" style="height: 25px;" image="chrome://scrapbook/skin/expander_up.png" tooltiptext="&sbp.combine.up;" oncommand="sbCombineService.moveUp();" />
<button id="sbpDown" disabled="true" style="height: 25px;" image="chrome://scrapbook/skin/expander_down.png" tooltiptext="&sbp.combine.down;" oncommand="sbCombineService.moveDown();" />
<button id="sbpDelete" disabled="true" style="height: 25px;" image="chrome://scrapbook/skin/menu_remove.png" tooltiptext="&sbp.combine.remove;" oncommand="sbCombineService.deleteItem();" />
<button id="sbpUp" disabled="true" style="height: 25px;" image="chrome://scrapbook/skin/expander_up.png" tooltiptext="&sbp.combine.up; (Alt+Up)" oncommand="sbCombineService.moveUp();" />
<button id="sbpDown" disabled="true" style="height: 25px;" image="chrome://scrapbook/skin/expander_down.png" tooltiptext="&sbp.combine.down; (Alt+Down)" oncommand="sbCombineService.moveDown();" />
<button id="sbpDelete" disabled="true" style="height: 25px;" image="chrome://scrapbook/skin/menu_remove.png" tooltiptext="&sbp.combine.remove; (Del)" oncommand="sbCombineService.deleteItem();" />
</vbox>
</hbox>
</vbox>
Expand Down
20 changes: 20 additions & 0 deletions chrome/content/scrapbook/detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,26 @@ var sbCaptureOptions = {
var res = sbCommonUtils.RDF.GetResource("urn:scrapbook:item" + this.param.item.id);
sbDataSource.setProperty(res, "title", document.getElementById("sbDetailTitle").value);
}
// check for regex error
var errors = [];
this.param.option["downLinkFilter"].split(/[\r\n]/).forEach(function (srcLine, index) {
if (srcLine.charAt(0) === "#") return;
var line = srcLine.trim();
if (line === "") return;
try {
new RegExp("^(?:" + line + ")$", "i");
} catch (ex) {
line = sbCommonUtils.lang("ERR_CAPTURE_DOWNLINKFILTER_LINE", index+1, srcLine);
errors.push(line);
}
});
if (errors.length) {
var button = sbCommonUtils.PROMPT.STD_YES_NO_BUTTONS;
var text = sbCommonUtils.lang("ERR_CAPTURE_DOWNLINKFILTER", errors.join("\n\n"));
// yes => 0, no => 1, close => 1
return sbCommonUtils.PROMPT.confirmEx(null, "[ScrapBook]", text, button, null, null, null, null, {});
}
return true;
},

cancel: function() {
Expand Down
2 changes: 1 addition & 1 deletion chrome/content/scrapbook/detail.xul
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
style="width: 400px;"
persist="screenX screenY"
onload="sbCaptureOptions.init();"
ondialogaccept="sbCaptureOptions.accept();"
ondialogaccept="return sbCaptureOptions.accept();"
ondialogcancel="sbCaptureOptions.cancel();">

<script type="application/x-javascript" src="chrome://scrapbook/content/common.js" />
Expand Down
4 changes: 2 additions & 2 deletions chrome/content/scrapbook/result.xul
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

<popupset>
<menupopup id="sbPopup">
<menuitem id="sbPopupOpen" label="&sb.open;" oncommand="sbSearchResult.forward('O');" />
<menuitem id="sbPopupOpen" label="&sb.open;" oncommand="sbSearchResult.forward('O');" />
<menuitem id="sbPopupOpenNewTab" label="&sb.open.newtab;" oncommand="sbSearchResult.forward('T');" />
<menuitem id="sbPopupOpenLocate" label="&sb.locate;" oncommand="sbSearchResult.forward('L');" />
<menuitem id="sbPopupOpenLocate" label="&sb.locate;" oncommand="sbSearchResult.forward('L');" class="menuitem-iconic" />
<menuseparator />
<menuitem id="sbPopupProperty" class="menuitem-iconic" label="&sb.property;" oncommand="sbSearchResult.forward('P');" />
</menupopup>
Expand Down
2 changes: 2 additions & 0 deletions chrome/content/scrapbook/saver.js
Original file line number Diff line number Diff line change
Expand Up @@ -1197,6 +1197,8 @@ var sbContentSaver = {
var ret = [];
that.option["downLinkFilter"].split(/[\r\n]/).forEach(function (line) {
if (line.charAt(0) === "#") return;
line = line.trim();
if (line === "") return;
try {
var regex = new RegExp("^(?:" + line + ")$", "i");
ret.push(regex);
Expand Down
16 changes: 8 additions & 8 deletions chrome/content/scrapbook/scrapbook.xul
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,19 @@
<spacer flex="1" />
<toolbarbutton type="menu" label="&sb.tools; ">
<menupopup id="sbToolsMenuPopup">
<menuitem label="&sb.tools.options;..." oncommand="sbMainService.openPrefWindow();" />
<menuitem label="&sb.tools.options;..." oncommand="sbMainService.openPrefWindow();" />
<menuseparator />
<menuitem label="&sb.tools.manage;..." oncommand="sbCommonUtils.openManageWindow(null,null);" />
<menuitem label="&sb.tools.combine;..." oncommand="sbCommonUtils.openManageWindow(null,'sbToolbarCombine');" />
<menuitem label="&sb.tools.trade;..." oncommand="sbCommonUtils.openManageWindow(null,'sbToolbarTrade');" />
<menuitem label="&sb.tools.multiple;..." oncommand="window.top.openDialog('chrome://scrapbook/content/multiple.xul','','chrome,centerscreen,all,resizable,dialog=no');" />
<menuitem id="sbToolsMenuPopupManage" class="menuitem-iconic" label="&sb.tools.manage;..." oncommand="sbCommonUtils.openManageWindow(null,null);" />
<menuitem label="&sb.tools.combine;..." oncommand="sbCommonUtils.openManageWindow(null,'sbToolbarCombine');" />
<menuitem label="&sb.tools.trade;..." oncommand="sbCommonUtils.openManageWindow(null,'sbToolbarTrade');" />
<menuitem id="sbToolsMenuPopupMultiple" class="menuitem-iconic" label="&sb.tools.multiple;..." oncommand="window.top.openDialog('chrome://scrapbook/content/multiple.xul','','chrome,centerscreen,all,resizable,dialog=no');" />
<menuitem label="&sb.tools.directory;" oncommand="sbController.launch(sbCommonUtils.getScrapBookDir());" />
<menuseparator />
<menu id="sbAddOns" label="&sb.tools.addons;"><menupopup id="sbAddOnsPopup" /></menu>
<menuitem label="&sb.tools.calculate;" oncommand="window.openDialog('chrome://scrapbook/content/calculate.xul','ScrapBook:Calculate','chrome,centerscreen,all,resizable,dialog=no');" />
<menuitem label="&sb.tools.sorttree;..." oncommand="window.openDialog('chrome://scrapbook/content/sort.xul','','chrome,centerscreen,modal');" />
<menuitem label="&sb.tools.output;..." oncommand="window.openDialog('chrome://scrapbook/content/output.xul','ScrapBook:Output','chrome,centerscreen,modal,resizable');" />
<menuitem label="&sb.tools.repair;..." oncommand="window.openDialog('chrome://scrapbook/content/repair.xul','ScrapBook:Repair','chrome,centerscreen,all,modal,resizable,dialog=no');" />
<menuitem label="&sb.tools.sorttree;..." oncommand="window.openDialog('chrome://scrapbook/content/sort.xul','','chrome,centerscreen,modal');" />
<menuitem label="&sb.tools.output;..." oncommand="window.openDialog('chrome://scrapbook/content/output.xul','ScrapBook:Output','chrome,centerscreen,modal,resizable');" />
<menuitem label="&sb.tools.repair;..." oncommand="window.openDialog('chrome://scrapbook/content/repair.xul','ScrapBook:Repair','chrome,centerscreen,all,modal,resizable,dialog=no');" />
</menupopup>
</toolbarbutton>
</toolbar>
Expand Down
4 changes: 2 additions & 2 deletions chrome/content/scrapbook/tree.xul
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
<menu id="sbPopupTools" label="&sb.tools;" onmouseover="event.stopPropagation();">
<menupopup id="sbPopupToolsMenu">
<menuitem id="sbPopupShowFiles" label="&sb.show.files;" oncommand="sbController.forward(null,'L');" />
<menuitem id="sbPopupSend" label="&sb.move;..." oncommand="sbTreeHandler.send();" />
<menuitem id="sbPopupCopy" label="&sb.copy;..." oncommand="sbTreeHandler.copy();" />
<menuitem id="sbPopupSend" class="menuitem-iconic" label="&sb.move;..." oncommand="sbTreeHandler.send();" />
<menuitem id="sbPopupCopy" class="menuitem-iconic" label="&sb.copy;..." oncommand="sbTreeHandler.copy();" />
<menuseparator />
<menuitem id="sbPopupRenew" class="menuitem-iconic" label="&sb.renew;..." oncommand="sbController.renew(null, true);" onclick="if (event.button == 1) sbController.renew(null, false);" />
<menuitem id="sbPopupInternalize" class="menuitem-iconic" label="&sb.internalize;..." oncommand="sbController.internalize(null);" />
Expand Down
2 changes: 1 addition & 1 deletion chrome/locale/ar/scrapbook/message.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<!ENTITY sb.detail.linked.file.method0 "Disable download linked files">
<!ENTITY sb.detail.linked.file.method1 "Match URL file extension">
<!ENTITY sb.detail.linked.file.method2 "Match HTTP header and URL file extension">
<!ENTITY sb.detail.linked.file.desc "Files with a full extension matching any RegExp in the lines will be downloaded. Lines starting with &quot;#&quot; will be skipped. Invalid RegExp will be skipped.">
<!ENTITY sb.detail.linked.file.desc "Files with a full extension matching any RegExp in the lines will be downloaded. Lines starting with &quot;#&quot; will be skipped.The following RegExps are invalid and will be skipped on execution">
<!ENTITY sb.detail.linked.file.reset "Reset to default">
<!ENTITY sb.detail.linked.page "إلتقاط في العمق">
<!ENTITY sb.detail.linked.page.depth "عمق الارتباطات">
Expand Down
2 changes: 2 additions & 0 deletions chrome/locale/ar/scrapbook/message.properties
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ ERR_SEARCH_REGEXP_INAVLID=ERROR: Invalid regular expression '%S'
ERR_SEARCH_DATE_INAVLID=ERROR: Invalid date format '%S'
MSG_UPDATE_PREFS=Successfully updated preferences. Restart Firefox to apply full changes.
ERR_UPDATE_PREFS=ERROR: Failed to update preferences.\n\n%S
ERR_CAPTURE_DOWNLINKFILTER=The following RegExps are invalid and will be skipped on execution. Stop and fix them now?\n\n%S
ERR_CAPTURE_DOWNLINKFILTER_LINE=Line %S: %S


# -----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion chrome/locale/cs-CZ/scrapbook/message.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<!ENTITY sb.detail.linked.file.method0 "Disable download linked files">
<!ENTITY sb.detail.linked.file.method1 "Match URL file extension">
<!ENTITY sb.detail.linked.file.method2 "Match HTTP header and URL file extension">
<!ENTITY sb.detail.linked.file.desc "Files with a full extension matching any RegExp in the lines will be downloaded. Lines starting with &quot;#&quot; will be skipped. Invalid RegExp will be skipped.">
<!ENTITY sb.detail.linked.file.desc "Files with a full extension matching any RegExp in the lines will be downloaded. Lines starting with &quot;#&quot; will be skipped.The following RegExps are invalid and will be skipped on execution">
<!ENTITY sb.detail.linked.file.reset "Reset to default">
<!ENTITY sb.detail.linked.page "Hloubkové zachycení">
<!ENTITY sb.detail.linked.page.depth "Hloubkově procházet odkazy">
Expand Down
2 changes: 2 additions & 0 deletions chrome/locale/cs-CZ/scrapbook/message.properties
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ ERR_SEARCH_REGEXP_INAVLID=ERROR: Invalid regular expression '%S'
ERR_SEARCH_DATE_INAVLID=ERROR: Invalid date format '%S'
MSG_UPDATE_PREFS=Successfully updated preferences. Restart Firefox to apply full changes.
ERR_UPDATE_PREFS=ERROR: Failed to update preferences.\n\n%S
ERR_CAPTURE_DOWNLINKFILTER=The following RegExps are invalid and will be skipped on execution. Stop and fix them now?\n\n%S
ERR_CAPTURE_DOWNLINKFILTER_LINE=Line %S: %S


# -----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion chrome/locale/de/scrapbook/message.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<!ENTITY sb.detail.linked.file.method0 "Disable download linked files">
<!ENTITY sb.detail.linked.file.method1 "Match URL file extension">
<!ENTITY sb.detail.linked.file.method2 "Match HTTP header and URL file extension">
<!ENTITY sb.detail.linked.file.desc "Files with a full extension matching any RegExp in the lines will be downloaded. Lines starting with &quot;#&quot; will be skipped. Invalid RegExp will be skipped.">
<!ENTITY sb.detail.linked.file.desc "Files with a full extension matching any RegExp in the lines will be downloaded. Lines starting with &quot;#&quot; will be skipped.The following RegExps are invalid and will be skipped on execution">
<!ENTITY sb.detail.linked.file.reset "Reset to default">
<!ENTITY sb.detail.linked.page "Archivierungstiefe">
<!ENTITY sb.detail.linked.page.depth "Verzeichnistiefe der Links">
Expand Down
2 changes: 2 additions & 0 deletions chrome/locale/de/scrapbook/message.properties
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ ERR_SEARCH_REGEXP_INAVLID=ERROR: Invalid regular expression '%S'
ERR_SEARCH_DATE_INAVLID=ERROR: Invalid date format '%S'
MSG_UPDATE_PREFS=Successfully updated preferences. Restart Firefox to apply full changes.
ERR_UPDATE_PREFS=ERROR: Failed to update preferences.\n\n%S
ERR_CAPTURE_DOWNLINKFILTER=The following RegExps are invalid and will be skipped on execution. Stop and fix them now?\n\n%S
ERR_CAPTURE_DOWNLINKFILTER_LINE=Line %S: %S


# -----------------------------------------------------------------------------
Expand Down
Loading

0 comments on commit 381476b

Please sign in to comment.