Explorar o código

removed forbidden icon and deprecated HTML notifications

Gildas lormeau %!s(int64=12) %!d(string=hai) anos
pai
achega
6333df26ce

+ 1 - 4
WebContent/ui/manifest.json

@@ -28,10 +28,7 @@
   "web_accessible_resources": [
     "pages/banner.html",
     "pages/banner.css",
-    "scripts/content/banner.js",
-    "pages/notification.html",
-    "pages/notification.css",
-    "scripts/bg/notification.js"
+    "scripts/content/banner.js"
   ],
   "permissions": [ "tabs", "notifications", "contextMenus" ],
   "minimum_chrome_version" : "7",

+ 1 - 1
WebContent/ui/pages/help.css

@@ -71,7 +71,7 @@ ol>li>ul>li {
 	background-image: url(../resources/options_screen.png);
 	background-repeat: no-repeat;
 	background-position: center center;
-	height: 562px;
+	height: 529px;
 }
 
 #title {

+ 6 - 13
WebContent/ui/pages/help.html

@@ -23,8 +23,7 @@
 	</ul>
 	<p>Additional notes:</p>
 	<ul>
-		<li>You can use the context menu to process the whole page ("process page"), the selected part of a page ("process selection") or a frame ("process frame")</li>
-		<li>Since version 0.3.0 of SingleFile, the default behavior is to show a banner, which allows you to easily save the page into the Downloads directory. To use the Chrome File->Save As... dialog and save the file to a selected location, uncheck the <span class="option">display save banner</span> and <span class="option">display save notification</span> in the options page.</li>		
+		<li>You can use the context menu to process the whole page ("process page"), the selected part of a page ("process selection") or a frame ("process frame")</li>		
 	</ul>
 	</li>
 	<li><a id="demo">Demo</a>
@@ -56,14 +55,9 @@
 		<p class="notice">It is recommended to <u>check</u> this option</p>
 		</li>
 
-		<li><span class="option">display save banner</span> (only with Chrome 15+)
-		<p>Check this option to display a banner with a download link at the top of the page when processing is finished. If this option and <span class="option">display save notification</span> are not checked then you must manually save the page through Chrome "Save as" dialog (make sure that "Web page, Complete" type is selected) after it has been processed.</p>
-		<p class="notice">It is recommended to <u>check</u> this option or <span class="option">display save notification</span> option</p>
-		</li>
-
-		<li><span class="option">display save notification</span> (only with Chrome 17+)
-		<p>Check this option to display a notification with a download link when processing is finished. If this option and <span class="option">display save banner</span> are not checked then you must manually save the page through Chrome "Save as" dialog (make sure that "Web page, Complete" type is selected) after it has been processed.</p>
-		<p class="notice">It is recommended to <u>check</u> this option or <span class="option">display save banner</span> option</p>
+		<li><span class="option">display save banner</span>
+		<p>Check this option to display a banner with a download link at the top of the page when processing is finished. If this option is not checked then you must manually save the page through Chrome "Save as" dialog (make sure that "Web page, Complete" type is selected) after it has been processed.</p>
+		<p class="notice">It is recommended to <u>check</u> this option</p>
 		</li>
 
 		<li><span class="option">remove scripts</span>
@@ -105,8 +99,7 @@
 		<li>all images are converted into <a href="http://en.wikipedia.org/wiki/Base64">base64</a></li>
 		<li>frame document contents are encoded with <a href="http://en.wikipedia.org/wiki/Utf_8">UTF-8 charset</a></li>
 		<li>encoded contents are injected in the document using <a href="http://en.wikipedia.org/wiki/Data_URI_scheme">data URI scheme</a></li>
-		<li>data URI scheme is supported by the following web browsers: Chrome, Firefox, Opera, Safari, Konqueror and Internet Explorer 8 (limited support: data URIs must be smaller
-		than 32 KB, embedded frames are not supported)</li>
+		<li>data URI scheme is supported by the following web browsers: Chrome, Firefox, Opera, Safari, Konqueror and Internet Explorer</li>
 		<li>SVG images are supported (SVG document is converted into UTF-8 but is not processed)</li>
 	</ul>
 	</li>
@@ -126,7 +119,7 @@
 	<p>If you find an unknown issue (i.e. frozen process, extra saved files, blank or altered document, tab crash...):</p>
 	<ul>
 		<li>reset SingleFile options</li>
-		<li>if option reseting did not work, try to uncheck <span class="option">display save notification</span> and <span class="option">display save banner</span> and make sure that <span class="option">process in background</span> is unchecked: you will have to use Chrome "Save as" dialog to save the page (select "Webpage, Complete" type in "Save as" dialog).</li>
+		<li>if option reseting did not work, try to <span class="option">display save banner</span> and make sure that <span class="option">process in background</span> is unchecked: you will have to use Chrome "Save as" dialog to save the page (select "Webpage, Complete" type in "Save as" dialog).</li>
 		<li>disable all other extensions to see if there is a conflict</li>
 		<li>if there is a conflict then try to determine against which extension(s)</li>
 		<li>please report the issue <a href="https://github.com/gildas-lormeau/SingleFile/issues">here</a> with a short description describing how to reproduce the issue, Chrome version, OS name and version.</li>

+ 0 - 14
WebContent/ui/pages/notification.css

@@ -1,14 +0,0 @@
-html {
-	font-family: sans-serif;
-	font-size: 11pt;
-	width: 300px;
-	height: 40px;
-}
-
-a {
-	width: 290px;
-	display: inline-block;
-	overflow: hidden;
-	text-overflow: ellipsis;
-	white-space: nowrap;
-}

+ 0 - 12
WebContent/ui/pages/notification.html

@@ -1,12 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-<link rel="stylesheet" href="notification.css">
-<title>SingleFile notification</title>
-</head>
-<body>
-	<a id="link"></a>
-	<script src="../scripts/bg/notification.js"></script>
-</body>
-</html>

+ 1 - 8
WebContent/ui/pages/options.html

@@ -43,14 +43,7 @@
 		<label for="displayBannerInput">display save banner <img class="question-mark" src="../resources/icon_question_mark.jpg"></label> <input type="checkbox" id="displayBannerInput">
 		<div class="help">
 			<p>Check this option to display a banner with a download link at the top of the page when processing is finished.</p>
-			<p class="notice">It is recommended to <u>check</u> this option or "display save notification" option</p>
-		</div>
-	</div>
-	<div class="option">
-		<label for="displayNotificationInput">display save notification <img class="question-mark" src="../resources/icon_question_mark.jpg"></label> <input type="checkbox" id="displayNotificationInput">
-		<div class="help">
-			<p>Check this option to display a notification with a download link when processing is finished.</p>
-			<p class="notice">It is recommended to <u>check</u> this option or "display save banner" option</p>
+			<p class="notice">It is recommended to <u>check</u> this option</p>
 		</div>
 	</div>
 	<h4>Advanced options</h4>

BIN=BIN
WebContent/ui/resources/icon_19_forbidden.png


BIN=BIN
WebContent/ui/resources/options_screen.png


+ 1 - 2
WebContent/ui/scripts/bg/background.js

@@ -119,8 +119,7 @@
 				type : "text/html"
 			});
 			url = webkitURL.createObjectURL(blob);
-			singlefile.ui.notifyProcessEnd(request.tabId, request.processingPagesCount, singlefile.config.get().displayNotification,
-					singlefile.config.get().displayBanner, url, request.title);
+			singlefile.ui.notifyProcessEnd(request.tabId, request.processingPagesCount, singlefile.config.get().displayBanner, url, request.title);
 			notifyPageArchiver(request);
 		}
 		if (request.processError)

+ 9 - 1
WebContent/ui/scripts/bg/config.js

@@ -39,7 +39,6 @@
 			getRawDoc : false,
 			displayInContextMenu : true,
 			sendToPageArchiver : false,
-			displayNotification : false,
 			displayBanner: true
 		};
 	};
@@ -73,5 +72,14 @@
 			singlefile.config.set(conf);
 		}
 	}
+	
+	// migration 0.3.6 -> 0.3.7
+	if (localStorage.config) {
+		var conf = singlefile.config.get();
+		if (typeof conf.displayNotification != "undefined" && conf.displayNotification) {
+			conf.displayBanner = true;
+			singlefile.config.set(conf);
+		}
+	}
 
 })();

+ 4 - 8
WebContent/ui/scripts/bg/options.js

@@ -19,7 +19,7 @@
  */
 (function() {
 
-	var removeScriptsInput, removeFramesInput, removeObjectsInput, removeHiddenInput, removeUnusedCSSRulesInput, processInBackgroundInput, getRawDocInput, sendToPageArchiverInput, displayNotificationInput, displayBannerInput, displayInContextMenuInput, bgPage = chrome.extension
+	var removeScriptsInput, removeFramesInput, removeObjectsInput, removeHiddenInput, removeUnusedCSSRulesInput, processInBackgroundInput, getRawDocInput, sendToPageArchiverInput, displayBannerInput, displayInContextMenuInput, bgPage = chrome.extension
 			.getBackgroundPage(), config;
 
 	function refresh() {
@@ -30,12 +30,11 @@
 		removeHiddenInput.checked = config.removeHidden;
 		removeUnusedCSSRulesInput.checked = config.removeUnusedCSSRules;
 		displayInContextMenuInput.checked = config.displayInContextMenu;
-		displayNotificationInput.checked = config.displayNotification;
 		displayBannerInput.checked = config.displayBanner;
 		processInBackgroundInput.checked = config.processInBackground;
 		getRawDocInput.checked = config.getRawDoc;
 		sendToPageArchiverInput.checked = config.sendToPageArchiver;
-		if (displayNotificationInput.checked || displayBannerInput.checked)
+		if (displayBannerInput.checked)
 			processInBackgroundInput.checked = processInBackgroundInput.disabled = true;
 	}
 
@@ -47,9 +46,8 @@
 			removeHidden : removeHiddenInput.checked,
 			removeUnusedCSSRules : removeUnusedCSSRulesInput.checked,
 			displayInContextMenu : displayInContextMenuInput.checked,
-			displayNotification : displayNotificationInput.checked,
 			displayBanner : displayBannerInput.checked,
-			displayProcessedPage : !displayNotificationInput.checked && !displayBannerInput.checked,
+			displayProcessedPage : !displayBannerInput.checked,
 			processInBackground : processInBackgroundInput.checked,
 			getRawDoc : getRawDocInput.checked,
 			sendToPageArchiver : sendToPageArchiverInput.checked
@@ -57,7 +55,7 @@
 	}
 
 	function updateProcessInBackground() {
-		processInBackgroundInput.checked = processInBackgroundInput.disabled = displayNotificationInput.checked || displayBannerInput.checked;
+		processInBackgroundInput.checked = processInBackgroundInput.disabled = displayBannerInput.checked;
 		update();
 	}
 
@@ -67,13 +65,11 @@
 	removeHiddenInput = document.getElementById("removeHiddenInput");
 	removeUnusedCSSRulesInput = document.getElementById("removeUnusedCSSRulesInput");
 	displayInContextMenuInput = document.getElementById("displayInContextMenuInput");
-	displayNotificationInput = document.getElementById("displayNotificationInput");
 	displayBannerInput = document.getElementById("displayBannerInput");
 	processInBackgroundInput = document.getElementById("processInBackgroundInput");
 	getRawDocInput = document.getElementById("getRawDocInput");
 	sendToPageArchiverInput = document.getElementById("sendToPageArchiverInput");
 	displayInContextMenuInput.addEventListener("click", bgPage.singlefile.refreshMenu);
-	displayNotificationInput.addEventListener("click", updateProcessInBackground, false);
 	displayBannerInput.addEventListener("click", updateProcessInBackground, false);
 	document.getElementById("resetButton").addEventListener("click", function() {
 		bgPage.singlefile.config.reset();

+ 8 - 11
WebContent/ui/scripts/bg/ui.js

@@ -23,7 +23,6 @@
 	singlefile.ui = {};
 
 	var DEFAULT_ICON_PATH = "../resources/icon_19.png";
-	var DEFAULT_PASSIVE_ICON_PATH = "../resources/icon_19_forbidden.png";
 	var DEFAULT_BADGE_CONFIG = {
 		text : "",
 		color : [ 64, 64, 64, 255 ],
@@ -104,10 +103,8 @@
 		refreshBadge(tabId);
 	};
 
-	singlefile.ui.notifyProcessEnd = function(tabId, processingPagesCount, displayNotification, displayBanner, url, title) {
-		var params = encodeURIComponent(url) + "&" + encodeURIComponent(title);
-		if (displayNotification)
-			webkitNotifications.createHTMLNotification("/pages/notification.html?" + params).show();
+	singlefile.ui.notifyProcessEnd = function(tabId, processingPagesCount, displayBanner, url, title) {
+		var params = encodeURIComponent(url) + "&" + encodeURIComponent(title);		
 		if (displayBanner)
 			chrome.tabs.sendMessage(tabId, {
 				displayBanner : true,
@@ -148,14 +145,14 @@
 	};
 
 	singlefile.ui.notifyProcessable = function(tabId, processable, reset) {
+		if (processable)
+			chrome.browserAction.enable(tabId);
 		if (!processable) {
-			tabs[tabId] = {
-				path : DEFAULT_PASSIVE_ICON_PATH,
-				title : "SingleFile cannot process this page"
-			};
-		} else if (reset && tabs[tabId] && !tabs[tabId].processing)
+			chrome.browserAction.disable(tabId);
+		} else if (reset && tabs[tabId] && !tabs[tabId].processing) {
 			delete tabs[tabId];
-		refreshBadge(tabId);
+			refreshBadge(tabId);
+		}
 	};
 
 })();