[Pkg-mozext-commits] [sage-extension] 05/20: date parsing enhancement, misc fixes

David Prévot taffit at moszumanska.debian.org
Fri May 1 03:10:25 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to tag sage_1_2
in repository sage-extension.

commit 824a6c0449b2e5f24b379350a8119e0ed751f0d8
Author: Peter Andrews <petea at jhu.edu>
Date:   Sun Jun 27 20:29:17 2004 +0000

    date parsing enhancement, misc fixes
---
 src/install.rdf                        |  56 ++++++-------
 src/sage/content/commonfunc.js         |  11 +--
 src/sage/content/createhtml.js         |   3 +-
 src/sage/content/feedlib.js            |   2 +-
 src/sage/content/opml/opml.js          | 149 ++++++++++++++++-----------------
 src/sage/content/res/sage.css          |   5 ++
 src/sage/content/sage-Overlay.xul      |   6 +-
 src/sage/content/sage.js               | 120 +++++++++++++++++---------
 src/sage/content/settings/settings.js  |   5 ++
 src/sage/content/settings/settings.xul |   1 +
 src/sage/locale/en-US/sage.dtd         |   1 +
 src/sage/locale/en-US/sage.properties  |  45 +++++++++-
 src/sage/locale/fr-FR/sage.dtd         |   1 +
 src/sage/locale/fr-FR/sage.properties  |  45 +++++++++-
 src/sage/locale/hu-HU/sage.dtd         |   1 +
 src/sage/locale/hu-HU/sage.properties  |  43 ++++++++++
 src/sage/locale/ja-JP/sage.dtd         |   1 +
 src/sage/locale/ja-JP/sage.properties  |  45 +++++++++-
 18 files changed, 380 insertions(+), 160 deletions(-)

diff --git a/src/install.rdf b/src/install.rdf
index 4eb8d1c..b056567 100644
--- a/src/install.rdf
+++ b/src/install.rdf
@@ -2,38 +2,38 @@
 
 <RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">
 
- <Description about="urn:mozilla:install-manifest">
+<Description about="urn:mozilla:install-manifest">
  
- <em:id>{a6ca9b3b-5e52-4f47-85d8-cca35bb57596}</em:id>
- <em:name>Sage</em:name>
- <em:version>1.1</em:version>
- <em:description>A lightweight RSS and ATOM feed aggregator.</em:description>
- <em:creator>The Sage Project</em:creator>
- <em:contributor>Peter Andrews</em:contributor>
- <em:contributor>flyson</em:contributor>
- <em:homepageURL>http://sage.mozdev.org</em:homepageURL>
- <em:optionsURL>chrome://sage/content/settings/settings.xul</em:optionsURL>
- <em:iconURL>chrome://sage/skin/sage_icon.png</em:iconURL>
+<em:id>{a6ca9b3b-5e52-4f47-85d8-cca35bb57596}</em:id>
+<em:name>Sage</em:name>
+<em:version>1.1</em:version>
+<em:description>A lightweight RSS and ATOM feed aggregator.</em:description>
+<em:creator>The Sage Project</em:creator>
+<em:contributor>Peter Andrews</em:contributor>
+<em:contributor>flyson</em:contributor>
+<em:homepageURL>http://sage.mozdev.org</em:homepageURL>
+<em:optionsURL>chrome://sage/content/settings/settings.xul</em:optionsURL>
+<em:iconURL>chrome://sage/skin/sage_icon.png</em:iconURL>
  
- <em:file>
- <Description about="urn:mozilla:extension:file:sage.jar">
- <em:package>content/</em:package>
- <em:skin>skin/classic/</em:skin>
- <em:locale>locale/en-US/</em:locale>
- <em:locale>locale/ja-JP/</em:locale>
- <em:locale>locale/fr-FR/</em:locale>
+<em:file>
+<Description about="urn:mozilla:extension:file:sage.jar">
+<em:package>content/</em:package>
+<em:skin>skin/classic/</em:skin>
+<em:locale>locale/en-US/</em:locale>
+<em:locale>locale/ja-JP/</em:locale>
+<em:locale>locale/fr-FR/</em:locale>
 <em:locale>locale/hu-HU/</em:locale>
- </Description>
- </em:file>
+</Description>
+</em:file>
 
- <em:targetApplication>
- <Description>
- <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
- <em:minVersion>0.7</em:minVersion>
- <em:maxVersion>0.9</em:maxVersion>
- </Description>
- </em:targetApplication>
+<em:targetApplication>
+<Description>
+<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
+<em:minVersion>0.7</em:minVersion>
+<em:maxVersion>0.9.9+</em:maxVersion>
+</Description>
+</em:targetApplication>
  
- </Description>
+</Description>
 
 </RDF>
\ No newline at end of file
diff --git a/src/sage/content/commonfunc.js b/src/sage/content/commonfunc.js
index 83b4f0f..29d3ae5 100755
--- a/src/sage/content/commonfunc.js
+++ b/src/sage/content/commonfunc.js
@@ -8,6 +8,7 @@ var CommonFunc = {
 	ALLOW_ENCODED_CONTENT: "sage.allow_encoded_content",
 	AUTO_FEED_TITLE: "sage.auto_feed_title",
 	RENDER_FEEDS: "sage.render_feeds",
+	TWELVE_HOUR_CLOCK: "sage.twelve_hour_clock",
 
 
 // ++++++++++ ++++++++++ Bookmark RDF ++++++++++ ++++++++++
@@ -129,10 +130,10 @@ var CommonFunc = {
 		if(!aNode.hasChildNodes()) return "";
 	
 		var resultArray = new Array();
-		var currentNode;
-		var walker = aNode.ownerDocument.createTreeWalker(aNode,
-						NodeFilter.SHOW_CDATA_SECTION | NodeFilter.SHOW_TEXT, null, false);
-		while(currentNode = walker.nextNode()) resultArray.push(currentNode.nodeValue);
+		var walker = aNode.ownerDocument.createTreeWalker(aNode, NodeFilter.SHOW_CDATA_SECTION | NodeFilter.SHOW_TEXT, null, false);
+		while(walker.nextNode()) {
+			resultArray.push(walker.currentNode.nodeValue);
+		}
 		return resultArray.join('').replace(/^\s+|\s+$/g, "");
 	},
 
@@ -286,4 +287,4 @@ var CommonFunc = {
 	}
 
 
-}
\ No newline at end of file
+}
diff --git a/src/sage/content/createhtml.js b/src/sage/content/createhtml.js
index 5c5e7c4..435b0b6 100755
--- a/src/sage/content/createhtml.js
+++ b/src/sage/content/createhtml.js
@@ -68,6 +68,7 @@ var CreateHTML = {
 
 	createHTMLSource: function(feed) {
 		var allowEContent = CommonFunc.getPrefValue(CommonFunc.ALLOW_ENCODED_CONTENT, "bool", true);
+		var twelveHourClock = CommonFunc.getPrefValue(CommonFunc.TWELVE_HOUR_CLOCK, "bool", false);
 
 		var htmlSource = this.HTML_SOURCE;
 		var cssUrl	= this.getUserCssURL();
@@ -94,7 +95,7 @@ var CreateHTML = {
 			}
 
 			if(feed.getItem(i).hasPubDate()) {
-				pubDate = "<div class=\"item-pubDate\">" + feed.getItem(i).getPubDate().toLocaleString() + "</div>";
+				pubDate = "<div class=\"item-pubDate\">" + dateFormat(feed.getItem(i).getPubDate(), twelveHourClock) + "</div>";
 			}
 
 			var itemSource = this.ITEM_SOURCE;
diff --git a/src/sage/content/feedlib.js b/src/sage/content/feedlib.js
index 428fd3b..d106a0c 100644
--- a/src/sage/content/feedlib.js
+++ b/src/sage/content/feedlib.js
@@ -164,7 +164,7 @@ Feed.prototype.parseATOM = function() {
 
 		var contentNodes = aEntryNode.getElementsByTagName("content");
 		var contentArray = new Array();
-		for(var j = 0; j < contentNodes.length; j++){
+		for(j = 0; j < contentNodes.length; j++){
 			var contType = contentNodes[j].getAttribute("type");
 			contentArray[contType] = CommonFunc.getInnerText(contentNodes[j]);
 		}
diff --git a/src/sage/content/opml/opml.js b/src/sage/content/opml/opml.js
index 87aa92b..dc13b85 100755
--- a/src/sage/content/opml/opml.js
+++ b/src/sage/content/opml/opml.js
@@ -9,7 +9,7 @@ var txtImportFile;
 var txtExportFile;
 
 
-function init(){
+function init() {
 		// Bookmarks Service
 	initServices();
 	initBMService();
@@ -19,69 +19,67 @@ function init(){
 	txtExportFile = document.getElementById("txtExportFile");
 }
 
-function finish(){
-	if(wizMode == WIZ_MODE_IMPORT){
+function finish() {
+	if(wizMode == WIZ_MODE_IMPORT) {
 		if(!checkFilePath(txtImportFile.value, true)) return false;
 		if(!importOPML()) return false;
-	}else{
+		alert("Import Complete");
+	} else {
 		if(!checkFilePath(txtExportFile.value, false)) return false;
 		exportOPML();
+		alert("Export Complete");
 	}
 	
-	alert("complete");
 	return true;
 }
 
 
-function browseImportFile(){
-	var fpicker = Components.classes["@mozilla.org/filepicker;1"]
-					.createInstance(Components.interfaces.nsIFilePicker);
+function browseImportFile() {
+	var fpicker = Components.classes["@mozilla.org/filepicker;1"].createInstance(Components.interfaces.nsIFilePicker);
 	fpicker.init(window, "Select OPML File", fpicker.modeOpen);
 	fpicker.appendFilter("OPML File(*.xml, *.opml)", "*.xml;*.opml");
 	fpicker.appendFilters(fpicker.filterAll);
 
 	var showResult = fpicker.show();
-	if(showResult == fpicker.returnOK){
+	if(showResult == fpicker.returnOK) {
 		txtImportFile.value = fpicker.file.path;	
 	}
 }
 
-function browseExportFile(){
-	var fpicker = Components.classes["@mozilla.org/filepicker;1"]
-					.createInstance(Components.interfaces.nsIFilePicker);
+function browseExportFile() {
+	var fpicker = Components.classes["@mozilla.org/filepicker;1"].createInstance(Components.interfaces.nsIFilePicker);
 	fpicker.init(window, "Select OPML File", fpicker.modeSave);
 	fpicker.appendFilter("OPML File(*.xml, *.opml)", "*.xml;*.opml");
 	fpicker.appendFilters(fpicker.filterAll);
 	fpicker.defaultString = "export.opml";
 
 	var showResult = fpicker.show();
-	if(showResult == fpicker.returnOK || showResult == fpicker.returnReplace){
+	if(showResult == fpicker.returnOK || showResult == fpicker.returnReplace) {
 		txtExportFile.value = fpicker.file.path;	
 	}
 }
 
 
 
-function checkFilePath(aFilePath, aExistCheck){
-	if(!aFilePath){
-		alert("Please choose a OPML file.");
+function checkFilePath(aFilePath, aExistCheck) {
+	if(!aFilePath) {
+		alert("Please choose an OPML file.");
 		return false;
 	}
 	
-	var tmpFile = Components.classes['@mozilla.org/file/local;1']
-					.createInstance(Components.interfaces.nsILocalFile);
-	try{
+	var tmpFile = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
+	try {
 		tmpFile.initWithPath(aFilePath);
-		if(aExistCheck){
-			if(!tmpFile.exists()){
+		if(aExistCheck) {
+			if(!tmpFile.exists()) {
 					// �t�@�C�������݂��Ȃ�
 				alert("The specified file does not exist.");
 				return false;
 			}
 		}
-	}catch(e){
+	} catch(e) {
 			// �s���ȃt�@�C���p�X
-		alert("unjust file path.")
+		alert("Invalid file path.")
 		return false;
 	}
 	
@@ -91,70 +89,68 @@ function checkFilePath(aFilePath, aExistCheck){
 
 
 // ********** ********** Import OPML ********** **********
-function importOPML(){
-	var uriFixup = Components.classes['@mozilla.org/docshell/urifixup;1']
-						.getService(Components.interfaces.nsIURIFixup);
-	var opmlUrl = uriFixup.createFixupURI(txtImportFile.value,
-					uriFixup.FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP);
+
+function importOPML() {
+	var uriFixup = Components.classes['@mozilla.org/docshell/urifixup;1'].getService(Components.interfaces.nsIURIFixup);
+	var opmlUrl = uriFixup.createFixupURI(txtImportFile.value, uriFixup.FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP);
 
 	var httpReq = new XMLHttpRequest();
-	try{
-		httpReq.open("GET" , opmlUrl.spec, false);
+	try {
+		httpReq.open("GET", opmlUrl.spec, false);
 		httpReq.overrideMimeType("application/xml");
 		httpReq.send(null);
-	}catch(e){
+	} catch(e) {
 		alert("Load Failure");
 		return false;
 	}
 	
 	opmlDoc = httpReq.responseXML;
-	if(opmlDoc.documentElement.localName != "opml"){
-		alert("This File Is Not OPML");
+	if(opmlDoc.documentElement.localName != "opml") {
+		alert("This does not appear to be an OPML file.");
 		return false;
 	}
-	var rssReaderFolderID = CommonFunc.getPrefValue(CommonFunc.RSS_READER_FOLDER_ID,
-								"str", "NC:BookmarksRoot");
+	var rssReaderFolderID = CommonFunc.getPrefValue(CommonFunc.RSS_READER_FOLDER_ID, "str", "NC:BookmarksRoot");
 
-	var folderName = "OPML Imported";
+	var folderName = "OPML Import";
 	var opmlTitles = opmlDoc.getElementsByTagName("title");
-	if(opmlTitles.length > 0){
+	if(opmlTitles.length > 0) {
 		var opmlTitle = CommonFunc.getInnerText(opmlTitles[0]);
 		folderName += " - " + opmlTitle;
 	}
-	var rootFolder = BMSVC.createFolderInContainer(folderName,
-								RDF.GetResource(rssReaderFolderID), 1);
+	var rootFolder = BMSVC.createFolderInContainer(folderName, RDF.GetResource(rssReaderFolderID), 1);
 
-	var treeWalker = opmlDoc.createTreeWalker(opmlDoc,
-								NodeFilter.SHOW_ELEMENT, outlineFiltter, true);
+	var treeWalker = opmlDoc.createTreeWalker(opmlDoc, NodeFilter.SHOW_ELEMENT, outlineFilter, true);
 
-	while(treeWalker.nextNode()){
+	while(treeWalker.nextNode()) {
 		var cNode = treeWalker.currentNode;
 		var pNode = cNode.parentNode;
-		var parentFolder = ("_folder" in pNode)? pNode._folder : rootFolder;
-		if(cNode.hasChildNodes()){
+		var parentFolder = ("_folder" in pNode) ? pNode._folder : rootFolder;
+		if(cNode.hasChildNodes()) {
 			var title = cNode.getAttribute("title");
 			if(!title) title = cNode.getAttribute("text");
 			if(!title) title = "folder";
-			cNode._folder = BMSVC.createFolderInContainer(title, parentFolder, 1);
-		}else{
+			cNode._folder = BMSVC.createFolderInContainer(title, parentFolder, null);
+		} else {
 			createRssItem(cNode, parentFolder);
 		}
 	}
 
-
 		// �u�b�N�}�[�N�̕ۑ�
 	BookmarksUtils.flushDataSource();
 
 	return true;
 }
 
-function outlineFiltter(aNode){
-	if(aNode.localName == "outline") return NodeFilter.FILTER_ACCEPT;
-	return NodeFilter.FILTER_SKIP;	
+function outlineFilter(aNode) {
+	if(aNode.localName == "outline") {
+		return NodeFilter.FILTER_ACCEPT;
+	} else {
+		return NodeFilter.FILTER_SKIP;
+	}
 }
 
 	// outline �v�f���� �u�b�N�}�[�N�A�C�e����쐬
-function createRssItem(aOutlineNode, aRssFolder){
+function createRssItem(aOutlineNode, aRssFolder) {
 	var type = aOutlineNode.getAttribute("type");
 	var title = aOutlineNode.getAttribute("title");
 	if(!title) title = aOutlineNode.getAttribute("text");
@@ -162,7 +158,7 @@ function createRssItem(aOutlineNode, aRssFolder){
 		// �s���S�� OUTLINE �͖�������
 	if(type!="rss" && !title && xmlUrl) return;
 
-	BMSVC.createBookmarkInContainer(title, xmlUrl, null, null, null, aRssFolder, 1)
+	BMSVC.createBookmarkInContainer(title, xmlUrl, null, null, null, null, aRssFolder, null);
 }
 
 
@@ -170,40 +166,36 @@ function createRssItem(aOutlineNode, aRssFolder){
 
 // ********** ********** Export OPML ********** **********
 
-
-function exportOPML(){
+function exportOPML() {
 	var opmlSource = createOpmlSource();
 	opmlSource = CommonFunc.convertCharCodeFrom(opmlSource, "UTF-8");
 
-	var tmpFile = Components.classes['@mozilla.org/file/local;1']
-					.createInstance(Components.interfaces.nsILocalFile);
-	try{
+	var tmpFile = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
+	try {
 		tmpFile.initWithPath(txtExportFile.value);
-		if(tmpFile.exists()){
+		if(tmpFile.exists()) {
 			tmpFile.remove(true);
 		}
 		tmpFile.create(tmpFile.NORMAL_FILE_TYPE, 0666);
-		var stream = Components.classes['@mozilla.org/network/file-output-stream;1']
-						.createInstance(Components.interfaces.nsIFileOutputStream);
+		var stream = Components.classes['@mozilla.org/network/file-output-stream;1'].createInstance(Components.interfaces.nsIFileOutputStream);
 		stream.init(tmpFile, 2, 0x200, false); // open as "write only"
 		stream.write(opmlSource, opmlSource.length);
 		stream.flush();
 		stream.close();
-	}catch(e){
-		alert("file create error");
+	} catch(e) {
+		alert("File creation error");
 	}
 }
 
 
-function createOpmlSource(){
-	var rssReaderFolderID = CommonFunc.getPrefValue(CommonFunc.RSS_READER_FOLDER_ID,
-								"str", "NC:BookmarksRoot");
+function createOpmlSource() {
+	var rssReaderFolderID = CommonFunc.getPrefValue(CommonFunc.RSS_READER_FOLDER_ID,"str", "NC:BookmarksRoot");
 	var rssReaderFolderRes = RDF.GetResource(rssReaderFolderID);
 	
 	var srcTemplate =  '<?xml version="1.0" encoding="UTF-8"?>';
-		srcTemplate += '<opml version="1.0">';
-		srcTemplate += '<head><title>RSS Reader Panel Export OPML</title></head>';
-		srcTemplate += '<body/></opml>';
+	srcTemplate += '<opml version="1.0">';
+	srcTemplate += '<head><title>RSS Reader Panel Export OPML</title></head>';
+	srcTemplate += '<body/></opml>';
 	
 	var opmlDoc = new DOMParser().parseFromString(srcTemplate, "text/xml");
 	var opmlBody = opmlDoc.getElementsByTagName("body")[0];
@@ -216,25 +208,24 @@ function createOpmlSource(){
 }
 
 
-function createOpmlOutline(aOpmlDoc, aRssItem){
+function createOpmlOutline(aOpmlDoc, aRssItem) {
 	var url = CommonFunc.getBMDSProperty(aRssItem, CommonFunc.BM_URL);
 	var title = CommonFunc.getBMDSProperty(aRssItem, CommonFunc.BM_NAME);
 	var isContainer = RDFCU.IsContainer(BMDS, aRssItem);
 	var outlineNode = aOpmlDoc.createElement("outline");
 
-	if(isContainer){
+	if(isContainer) {
 		outlineNode.setAttribute("text", title);
 		
-		var rdfContainer = Components.classes["@mozilla.org/rdf/container;1"]
-								.getService(Components.interfaces.nsIRDFContainer);
+		var rdfContainer = Components.classes["@mozilla.org/rdf/container;1"].getService(Components.interfaces.nsIRDFContainer);
 		rdfContainer.Init(BMDS, aRssItem);
 		var containerChildren = rdfContainer.GetElements();
 
-	   	while(containerChildren.hasMoreElements()){
+		while(containerChildren.hasMoreElements()) {
 			var res = containerChildren.getNext().QueryInterface(kRDFRSCIID);
 			outlineNode.appendChild(createOpmlOutline(aOpmlDoc, res));
 		}
-	}else{
+	} else {
 		outlineNode.setAttribute("type", "rss");
 		outlineNode.setAttribute("text", title);
 		outlineNode.setAttribute("title", title);
@@ -246,26 +237,26 @@ function createOpmlOutline(aOpmlDoc, aRssItem){
 
 
 	// XML �\�[�X�̃C���f���g
-function xmlIndent(aDoc){
+function xmlIndent(aDoc) {
 	var treeWalker = aDoc.createTreeWalker(aDoc, NodeFilter.SHOW_ELEMENT, null, true);
 	aDoc._depth = 0;
-	while(treeWalker.nextNode()){
+	while(treeWalker.nextNode()) {
 		var cNode = treeWalker.currentNode;
 		var pNode = cNode.parentNode;
 		var tmpTextNode;
 
-		if(pNode){
+		if(pNode) {
 			cNode._depth = pNode._depth + 1;
 			if(cNode == aDoc.documentElement) continue;
 			tmpTextNode = aDoc.createTextNode("\n" + getIndent(cNode._depth));
 			pNode.insertBefore(tmpTextNode, cNode);
 		}
-		if(!cNode.nextSibling){
+		if(!cNode.nextSibling) {
 			tmpTextNode = aDoc.createTextNode("\n" + getIndent(cNode._depth - 1));
 			pNode.appendChild(tmpTextNode);
 		}
 	}
-	function getIndent(aDepth){
+	function getIndent(aDepth) {
 		var result = new Array(aDepth);
 		return result.join("\t");
 	}
diff --git a/src/sage/content/res/sage.css b/src/sage/content/res/sage.css
index 956f92d..6e08079 100755
--- a/src/sage/content/res/sage.css
+++ b/src/sage/content/res/sage.css
@@ -84,4 +84,9 @@ div.item-technorati {
 	width: 20%;
 	float: right;
 	text-align: right;
+}
+
+img {
+	max-width: 100%;
+	height: auto;
 }
\ No newline at end of file
diff --git a/src/sage/content/sage-Overlay.xul b/src/sage/content/sage-Overlay.xul
index 2a84903..62a9069 100755
--- a/src/sage/content/sage-Overlay.xul
+++ b/src/sage/content/sage-Overlay.xul
@@ -2,8 +2,7 @@
 <?xml-stylesheet href="chrome://sage/skin/sage-button.css" type="text/css"?>
 
 <!DOCTYPE overlay SYSTEM "chrome://sage/locale/sage.dtd">
-<overlay id="sageOverlay"
-	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+<overlay id="sageOverlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
 	<menupopup id="viewSidebarMenu">
 		<menuitem key="key_openSageSidebar" observes="viewSageSidebar"/>
@@ -27,7 +26,6 @@
 
 
 	<toolbarpalette id="BrowserToolbarPalette">
-		<toolbarbutton id="sage-button" tooltiptext="&sage.tooltip;"
-			observes="viewSageSidebar" class="toolbarbutton-1"/>
+		<toolbarbutton id="sage-button" tooltiptext="&sage.tooltip;" observes="viewSageSidebar" class="toolbarbutton-1"/>
 	</toolbarpalette>
 </overlay>
diff --git a/src/sage/content/sage.js b/src/sage/content/sage.js
index c03c116..587ecc3 100755
--- a/src/sage/content/sage.js
+++ b/src/sage/content/sage.js
@@ -31,7 +31,6 @@ var aConsoleService
 
 
 function init() {
-	strRes = document.getElementById("strRes");
 	bookmarksTree = document.getElementById("bookmarksTree");
 	rssItemListBox = document.getElementById("rssItemListBox");
 	rssStatusImage = document.getElementById("rssStatusImage");
@@ -39,6 +38,7 @@ function init() {
 	rssTitleLabel = document.getElementById("rssTitleLabel");
 	rssItemListPopup = document.getElementById("rssItemListPopup");
 
+	strRes = document.getElementById("strRes");
 	resultStrArray = new Array(
 		strRes.getString("RESULT_OK_STR"),
 		strRes.getString("RESULT_PARSE_ERROR_STR"),
@@ -69,6 +69,49 @@ function logMessage(message) {
 	aConsoleService.logStringMessage("Sage: " + message);
 }
 
+function dateFormat(date, twelveHourClock) {
+	function padout(number) { return (number < 10) ? '0' + number : number; }
+
+	var day;
+	switch (date.getDay()) {
+		case 0: day = strRes.getString("date_sunday_short"); break
+		case 1: day = strRes.getString("date_monday_short"); break
+		case 2: day = strRes.getString("date_tuesday_short"); break
+		case 3: day = strRes.getString("date_wednesday_short"); break
+		case 4: day = strRes.getString("date_thursday_short"); break
+		case 5: day = strRes.getString("date_friday_short"); break
+		case 6: day = strRes.getString("date_saturday_short"); break
+	}
+
+	var month;
+	switch (date.getMonth()) {
+		case 0: month = strRes.getString("date_january_short"); break
+		case 1: month = strRes.getString("date_february_short"); break
+		case 2: month = strRes.getString("date_march_short"); break
+		case 3: month = strRes.getString("date_april_short"); break
+		case 4: month = strRes.getString("date_may_short"); break
+		case 5: month = strRes.getString("date_june_short"); break
+		case 6: month = strRes.getString("date_july_short"); break
+		case 7: month = strRes.getString("date_august_short"); break
+		case 8: month = strRes.getString("date_september_short"); break
+		case 9: month = strRes.getString("date_october_short"); break
+		case 10: month = strRes.getString("date_november_short"); break
+		case 11: month = strRes.getString("date_december_short"); break
+	}
+
+	var year = date.getYear() + 1900;
+
+	var date_str = day + " " + month + " " + date.getDate() + ", " + year; 
+
+	var hours = date.getHours(), minutes = padout(date.getMinutes()), seconds = padout(date.getSeconds());
+	if(twelveHourClock) {
+		var adjhours = (hours == 0) ? 12 : ((hours < 13) ? hours : hours-12);
+		var time_str = adjhours + ":" + minutes + ((hours < 12) ? " AM" : " PM");
+	} else {
+		var time_str = hours + ":" + minutes;
+	}
+	return date_str + " " + time_str;
+}
 
 	// �X�V���ꂽRSS�̂ݕ\��
 function showOnlyUpdated() {
@@ -156,24 +199,25 @@ function bookmarksOpen(){
 }
 
 
-function createTreeContextMenu2(aEvent){
+function createTreeContextMenu2(aEvent) {
 	var popup = aEvent.target;
 	if(popup.localName != "menupopup") return;
 
 	var selection = bookmarksTree._selection;
 	var itemId = selection.item[0].Value;
 	var cmdSrc = "";
+	var tempMenuItem;
 
-	if(selection.type == "Bookmark"){
+	if(selection.type == "Bookmark") {
 		cmdSrc = "GetRssTitle.getRssTitle('" + itemId + "')";
-		var tempMenuItem = document.createElement("menuitem");
+		tempMenuItem = document.createElement("menuitem");
 		tempMenuItem.setAttribute("label", strRes.getString("GET_RSS_TITLE"));
 		tempMenuItem.setAttribute("oncommand", cmdSrc);
 		popup.appendChild(document.createElement("menuseparator"));
 		popup.appendChild(tempMenuItem);
-	}else if(selection.type == "Folder"){
+	} else if(selection.type == "Folder") {
 		cmdSrc = "updateCheck('" + itemId + "')";
-		var tempMenuItem = document.createElement("menuitem");
+		tempMenuItem = document.createElement("menuitem");
 		tempMenuItem.setAttribute("label", strRes.getString("CHECK_UPDATE"));
 		tempMenuItem.setAttribute("oncommand", cmdSrc);
 		popup.appendChild(document.createElement("menuseparator"));
@@ -182,29 +226,28 @@ function createTreeContextMenu2(aEvent){
 }
 
 function bookmarksTreeClick(aEvent){
-	if(aEvent.type == "click"){
-		if(aEvent.button == 2 || aEvent.originalTarget.localName != "treechildren"){
+	if(aEvent.type == "click") {
+		if(aEvent.button == 2 || aEvent.originalTarget.localName != "treechildren") {
 			return;
 		}
 		var obj = {};
 		bookmarksTree.treeBoxObject.getCellAt(aEvent.clientX, aEvent.clientY, {}, {}, obj);
 		if(obj.value == "twisty") return;
-	}else if(aEvent.type == "keypress"){
-		if(aEvent.originalTarget.localName != "tree"){
+	} else if(aEvent.type == "keypress") {
+		if(aEvent.originalTarget.localName != "tree") {
 			return;
 		}
 	}
 	
 	CreateHTML.tabbed = false;
-	if(aEvent.button == 1){ CreateHTML.tabbed = true; } // click middle button
-	if(aEvent.ctrlKey){ CreateHTML.tabbed = true; } // press Ctrl Key
+	if(aEvent.button == 1) { CreateHTML.tabbed = true; } // click middle button
+	if(aEvent.ctrlKey) { CreateHTML.tabbed = true; } // press Ctrl Key
 
 	const BOOKMARK_TYPE = RDF_NS + "type";
 	const BOOKMARK_SEPARATOR = NC_NS + "BookmarkSeparator";
 	const BOOKMARK_FOLDER = NC_NS + "Folder"
-	var bookmarkType = (BookmarksUtils.getProperty(bookmarksTree.currentResource,
-							BOOKMARK_TYPE , bookmarksTree.db))
-	if(bookmarkType == BOOKMARK_SEPARATOR || bookmarkType == BOOKMARK_FOLDER){
+	var bookmarkType = (BookmarksUtils.getProperty(bookmarksTree.currentResource, BOOKMARK_TYPE , bookmarksTree.db))
+	if(bookmarkType == BOOKMARK_SEPARATOR || bookmarkType == BOOKMARK_FOLDER) {
 		return;
 	}
 	
@@ -213,13 +256,13 @@ function bookmarksTreeClick(aEvent){
 
 
 
-function rssItemListBoxClick(aEvent){
-	if(aEvent.type == "click"){
-		if(aEvent.button == 2 || aEvent.originalTarget.localName != "listitem"){
+function rssItemListBoxClick(aEvent) {
+	if(aEvent.type == "click") {
+		if(aEvent.button == 2 || aEvent.originalTarget.localName != "listitem") {
 			return;
 		}
-	}else if(aEvent.type == "keypress"){
-		if(aEvent.originalTarget.localName != "listbox"){
+	} else if(aEvent.type == "keypress") {
+		if(aEvent.originalTarget.localName != "listbox") {
 			return;
 		}
 	}
@@ -228,12 +271,12 @@ function rssItemListBoxClick(aEvent){
 	var link = currentFeed.getItem(selectedItem.value).getLink();
 	var tabbed = false;
 
-	if(aEvent.button == 1){ tabbed = true; } // click middle button
-	if(aEvent.ctrlKey){ tabbed = true; } // press Ctrl Key
+	if(aEvent.button == 1) { tabbed = true; } // click middle button
+	if(aEvent.ctrlKey) { tabbed = true; } // press Ctrl Key
 	
-	if(tabbed){
+	if(tabbed) {
 		getContentBrowser().addTab(link);	
-	}else{
+	} else {
 		getContentBrowser().loadURI(link);
 	}
 	selectedItem.setAttribute("visited", "true");
@@ -242,25 +285,25 @@ function rssItemListBoxClick(aEvent){
 
 function rssTitleLabelClick(aNode, aEvent){
 	var tabbed = false;
-	if(!aNode.hasAttribute("href") || aEvent.button == 2){
+	if(!aNode.hasAttribute("href") || aEvent.button == 2) {
 		return;
 	}
 
 	var link = aNode.getAttribute("href");
-	var tabbed = false;
+	tabbed = false;
 
-	if(aEvent.button == 1){ tabbed =true; } // click middle button
-	if(aEvent.ctrlKey){ tabbed = true; } // press Ctrl Key
+	if(aEvent.button == 1) { tabbed =true; } // click middle button
+	if(aEvent.ctrlKey) { tabbed = true; } // press Ctrl Key
 	
-	if(tabbed){
+	if(tabbed) {
 		getContentBrowser().addTab(link);	
-	}else{
+	} else {
 		getContentBrowser().loadURI(link);
 	}
 }
 
 
-function setStatusLoading(label){
+function setStatusLoading(label) {
 	rssStatusImage.setAttribute("loading", "true");
 	if(label) {
 		rssStatusLabel.value = "Loading: " + label;
@@ -269,32 +312,31 @@ function setStatusLoading(label){
 	}
 }
 
-function setStatusDone(){
+function setStatusDone() {
 	rssStatusImage.setAttribute("loading", "false");
 	rssStatusLabel.value = "";
 
-	if(currentFeed){
+	if(currentFeed) {
 		rssTitleLabel.value = htmlToText(currentFeed.getTitle());
-		if(currentFeed.getLink()){
+		if(currentFeed.getLink()) {
 			rssTitleLabel.setAttribute("href", currentFeed.getLink());
 			rssTitleLabel.tooltipText = currentFeed.getLink();
-		}else{
+		} else {
 			rssTitleLabel.removeAttribute("href");
 			rssTitleLabel.tooltipText = "";
 		}
 	}
 }
 
-function setStatusError(aStatus){
+function setStatusError(aStatus) {
 	rssStatusImage.setAttribute("loading", "error");
 	rssStatusLabel.value = "Error: " + aStatus;
 }
 
 
 	// �u���E�U�I�u�W�F�N�g��Ԃ�
-function getContentBrowser(){
-	var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1']
-							.getService(Components.interfaces.nsIWindowMediator);
+function getContentBrowser() {
+	var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService(Components.interfaces.nsIWindowMediator);
 	var topWindowOfType = windowManager.getMostRecentWindow("navigator:browser");
 	if (topWindowOfType) {
 		return topWindowOfType.document.getElementById('content');
diff --git a/src/sage/content/settings/settings.js b/src/sage/content/settings/settings.js
index 1daac5a..4444a52 100755
--- a/src/sage/content/settings/settings.js
+++ b/src/sage/content/settings/settings.js
@@ -6,6 +6,7 @@ var txtUserCssPath;
 var chkAllowEContent;
 var chkAutoFeedTitle;
 var chkRenderFeeds;
+var chkTwelveHourClock;
 
 var gList;
 var gNameArc;
@@ -36,6 +37,9 @@ function init() {
 	chkRenderFeeds = document.getElementById("chkRenderFeeds");
 	chkRenderFeeds.checked = CommonFunc.getPrefValue(CommonFunc.RENDER_FEEDS, "bool", true);
 
+	chkTwelveHourClock = document.getElementById("chkTwelveHourClock");
+	chkTwelveHourClock.checked = CommonFunc.getPrefValue(CommonFunc.TWELVE_HOUR_CLOCK, "bool", false);
+
 	setDisabled();
 
 	setTimeout(fillSelectFolderMenupopup, 0);
@@ -48,6 +52,7 @@ function accept() {
 	CommonFunc.setPrefValue(CommonFunc.ALLOW_ENCODED_CONTENT, "bool", chkAllowEContent.checked);
 	CommonFunc.setPrefValue(CommonFunc.AUTO_FEED_TITLE, "bool", chkAutoFeedTitle.checked);
 	CommonFunc.setPrefValue(CommonFunc.RENDER_FEEDS, "bool", chkRenderFeeds.checked);
+	CommonFunc.setPrefValue(CommonFunc.TWELVE_HOUR_CLOCK, "bool", chkTwelveHourClock.checked);
 }
 
 function selectFolder(aEvent){
diff --git a/src/sage/content/settings/settings.xul b/src/sage/content/settings/settings.xul
index 5b16c6f..0d42ac2 100755
--- a/src/sage/content/settings/settings.xul
+++ b/src/sage/content/settings/settings.xul
@@ -37,6 +37,7 @@
 <groupbox>
 	<caption label="&openInContentsArea.caption;"/>
 	<checkbox id="chkRenderFeeds" label="&settings.renderFeeds.label;"/>
+	<checkbox id="chkTwelveHourClock" label="&settings.twelveHourClock.label;"/>
 	<checkbox id="chkAllowEContent" label="&allowEContent.label;"/>
 	<vbox flex="1">
 		<checkbox id="chkUserCssEnable" label="&enableUserCss.label;" oncommand="setDisabled()"/>
diff --git a/src/sage/locale/en-US/sage.dtd b/src/sage/locale/en-US/sage.dtd
index 16857a9..4593c43 100755
--- a/src/sage/locale/en-US/sage.dtd
+++ b/src/sage/locale/en-US/sage.dtd
@@ -22,6 +22,7 @@
 <!ENTITY settings.general.caption     "General">
 <!ENTITY settings.autoFeedTitle.label     "Automatically update feed titles">
 <!ENTITY settings.renderFeeds.label     "Render feeds in contents area">
+<!ENTITY settings.twelveHourClock.label     "Use 12 hour clock">
 <!ENTITY settingWindow.title                    "Sage Settings">
 <!ENTITY selectFolder.label			"Select Feed Folder">
 <!ENTITY openInContentsArea.caption		"Feed Rendering">
diff --git a/src/sage/locale/en-US/sage.properties b/src/sage/locale/en-US/sage.properties
index e460e00..4b3e381 100755
--- a/src/sage/locale/en-US/sage.properties
+++ b/src/sage/locale/en-US/sage.properties
@@ -6,4 +6,47 @@ RESULT_NOT_AVAILABLE_STR = URL Not Available
 RESULT_ERROR_FAILURE_STR = Load Failure
 
 CHECK_UPDATE = Check Feeds
-GET_RSS_TITLE= Get Feed Title
\ No newline at end of file
+GET_RSS_TITLE= Get Feed Title
+
+
+# Date rendering values
+
+date_sunday = Sunday
+date_sunday_short = Sun
+date_monday = Monday
+date_monday_short = Mon
+date_tuesday = Tuesday
+date_tuesday_short = Tues
+date_wednesday = Wednesday
+date_wednesday_short = Wed
+date_thursday = Thursday
+date_thursday_short = Thu
+date_friday = Friday
+date_friday_short = Fri
+date_saturday = Saturday
+date_saturday_short = Sat
+
+date_january = January
+date_january_short = Jan
+date_february = February
+date_february_short = Feb
+date_march = March
+date_march_short = Mar
+date_april = April
+date_april_short = Apr
+date_may = May
+date_may_short = May
+date_june = June
+date_june_short = Jun
+date_july = July
+date_july_short = Jul
+date_august = August
+date_august_short = Aug
+date_september = September
+date_september_short = Sep
+date_october = October
+date_october_short = Oct
+date_november = November
+date_november_short = Nov
+date_december = December
+date_december_short = Dec
\ No newline at end of file
diff --git a/src/sage/locale/fr-FR/sage.dtd b/src/sage/locale/fr-FR/sage.dtd
index 8f5f72e..e01e240 100644
--- a/src/sage/locale/fr-FR/sage.dtd
+++ b/src/sage/locale/fr-FR/sage.dtd
@@ -23,6 +23,7 @@
 <!ENTITY settings.general.caption     "">
 <!ENTITY settings.autoFeedTitle.label     "">
 <!ENTITY settings.renderFeeds.label     "">
+<!ENTITY settings.twelveHourClock.label     "">
 <!ENTITY settingWindow.title                    "Configration de Sage">
 <!ENTITY selectFolder.label			"Sélection du dossier des fils">
 <!ENTITY openInContentsArea.caption		"Ouverture dans le zone de contenu">
diff --git a/src/sage/locale/fr-FR/sage.properties b/src/sage/locale/fr-FR/sage.properties
index f916bb8..20248cd 100644
--- a/src/sage/locale/fr-FR/sage.properties
+++ b/src/sage/locale/fr-FR/sage.properties
@@ -6,4 +6,47 @@ RESULT_NOT_AVAILABLE_STR = URL non disponible
 RESULT_ERROR_FAILURE_STR = Erreur de chargement
 
 CHECK_UPDATE = V\u00e9rification des fils
-GET_RSS_TITLE= Trouver le nom du fil
\ No newline at end of file
+GET_RSS_TITLE= Trouver le nom du fil
+
+
+# Date rendering values
+
+date_sunday = Sunday
+date_sunday_short = Sun
+date_monday = Monday
+date_monday_short = Mon
+date_tuesday = Tuesday
+date_tuesday_short = Tues
+date_wednesday = Wednesday
+date_wednesday_short = Wed
+date_thursday = Thursday
+date_thursday_short = Thu
+date_friday = Friday
+date_friday_short = Fri
+date_saturday = Saturday
+date_saturday_short = Sat
+
+date_january = January
+date_january_short = Jan
+date_february = February
+date_february_short = Feb
+date_march = March
+date_march_short = Mar
+date_april = April
+date_april_short = Apr
+date_may = May
+date_may_short = May
+date_june = June
+date_june_short = Jun
+date_july = July
+date_july_short = Jul
+date_august = August
+date_august_short = Aug
+date_september = September
+date_september_short = Sep
+date_october = October
+date_october_short = Oct
+date_november = November
+date_november_short = Nov
+date_december = December
+date_december_short = Dec
\ No newline at end of file
diff --git a/src/sage/locale/hu-HU/sage.dtd b/src/sage/locale/hu-HU/sage.dtd
index 9674672..2a960be 100755
--- a/src/sage/locale/hu-HU/sage.dtd
+++ b/src/sage/locale/hu-HU/sage.dtd
@@ -24,6 +24,7 @@
 <!ENTITY settings.general.caption     "�ltal�nos">
 <!ENTITY settings.autoFeedTitle.label     "C�mek automatikus friss�t�se">
 <!ENTITY settings.renderFeeds.label     "Megnyit�s a tartalmi r�szben">
+<!ENTITY settings.twelveHourClock.label     "">
 <!ENTITY settingWindow.title        "Az RSS olvas�panel be�ll�t�sai">
 <!ENTITY selectFolder.label         "V�lassza ki az RSS listamapp�t">
 <!ENTITY openInContentsArea.caption "Let�lt�ttek megjelen�t�se">
diff --git a/src/sage/locale/hu-HU/sage.properties b/src/sage/locale/hu-HU/sage.properties
index 0ecf318..b0da3ca 100755
--- a/src/sage/locale/hu-HU/sage.properties
+++ b/src/sage/locale/hu-HU/sage.properties
@@ -7,3 +7,46 @@ RESULT_ERROR_FAILURE_STR = Bet
 
 CHECK_UPDATE = Friss�l�sek ellen�rz�se
 GET_RSS_TITLE= RSS c�m let�lt�se
+
+
+# Date rendering values
+
+date_sunday = Sunday
+date_sunday_short = Sun
+date_monday = Monday
+date_monday_short = Mon
+date_tuesday = Tuesday
+date_tuesday_short = Tues
+date_wednesday = Wednesday
+date_wednesday_short = Wed
+date_thursday = Thursday
+date_thursday_short = Thu
+date_friday = Friday
+date_friday_short = Fri
+date_saturday = Saturday
+date_saturday_short = Sat
+
+date_january = January
+date_january_short = Jan
+date_february = February
+date_february_short = Feb
+date_march = March
+date_march_short = Mar
+date_april = April
+date_april_short = Apr
+date_may = May
+date_may_short = May
+date_june = June
+date_june_short = Jun
+date_july = July
+date_july_short = Jul
+date_august = August
+date_august_short = Aug
+date_september = September
+date_september_short = Sep
+date_october = October
+date_october_short = Oct
+date_november = November
+date_november_short = Nov
+date_december = December
+date_december_short = Dec
\ No newline at end of file
diff --git a/src/sage/locale/ja-JP/sage.dtd b/src/sage/locale/ja-JP/sage.dtd
index d01b3fe..83dec40 100755
--- a/src/sage/locale/ja-JP/sage.dtd
+++ b/src/sage/locale/ja-JP/sage.dtd
@@ -23,6 +23,7 @@
 <!ENTITY settings.general.caption     "">
 <!ENTITY settings.autoFeedTitle.label     "">
 <!ENTITY settings.renderFeeds.label     "">
+<!ENTITY settings.twelveHourClock.label     "">
 <!ENTITY settingWindow.title		"設定: RSS リーダパネル">
 <!ENTITY selectFolder.label			"RSS リストフォルダの選択">
 <!ENTITY openInContentsArea.caption	"コンテンツエリアで開く">
diff --git a/src/sage/locale/ja-JP/sage.properties b/src/sage/locale/ja-JP/sage.properties
index 150cf88..7faae6b 100755
--- a/src/sage/locale/ja-JP/sage.properties
+++ b/src/sage/locale/ja-JP/sage.properties
@@ -6,4 +6,47 @@ RESULT_NOT_AVAILABLE_STR = \u5b58\u5728\u3057\u306a\u3044 URL \u3067\u3059
 RESULT_ERROR_FAILURE_STR = \u8aad\u307f\u8fbc\u307f\u306b\u5931\u6557\u3057\u307e\u3057\u305f
 
 CHECK_UPDATE = \u66f4\u65b0\u30c1\u30a7\u30c3\u30af
-GET_RSS_TITLE= RSS \u30bf\u30a4\u30c8\u30eb\u306e\u53d6\u5f97
\ No newline at end of file
+GET_RSS_TITLE= RSS \u30bf\u30a4\u30c8\u30eb\u306e\u53d6\u5f97
+
+
+# Date rendering values
+
+date_sunday = Sunday
+date_sunday_short = Sun
+date_monday = Monday
+date_monday_short = Mon
+date_tuesday = Tuesday
+date_tuesday_short = Tues
+date_wednesday = Wednesday
+date_wednesday_short = Wed
+date_thursday = Thursday
+date_thursday_short = Thu
+date_friday = Friday
+date_friday_short = Fri
+date_saturday = Saturday
+date_saturday_short = Sat
+
+date_january = January
+date_january_short = Jan
+date_february = February
+date_february_short = Feb
+date_march = March
+date_march_short = Mar
+date_april = April
+date_april_short = Apr
+date_may = May
+date_may_short = May
+date_june = June
+date_june_short = Jun
+date_july = July
+date_july_short = Jul
+date_august = August
+date_august_short = Aug
+date_september = September
+date_september_short = Sep
+date_october = October
+date_october_short = Oct
+date_november = November
+date_november_short = Nov
+date_december = December
+date_december_short = Dec
\ No newline at end of file

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/sage-extension.git



More information about the Pkg-mozext-commits mailing list