mirror of
https://github.com/Oreolek/TrackMeNot-Chrome.git
synced 2024-05-11 13:38:19 +03:00
jshint fixes
This commit is contained in:
parent
b03e76e328
commit
fe7dd63229
42
editor.js
42
editor.js
|
@ -1,6 +1,3 @@
|
|||
|
||||
|
||||
|
||||
if(!TRACKMENOT) var TRACKMENOT = {};
|
||||
|
||||
TRACKMENOT.editor = function () {
|
||||
|
@ -27,7 +24,7 @@ TRACKMENOT.editor = function () {
|
|||
if (win.TRACKMENOT && win.TRACKMENOT.gTrackMeNot)
|
||||
return win;
|
||||
}
|
||||
return null
|
||||
return null;
|
||||
}
|
||||
|
||||
function cout(msg) {
|
||||
|
@ -53,19 +50,19 @@ TRACKMENOT.editor = function () {
|
|||
ti.setAttribute("hidden", true);
|
||||
//ti.setAttribute("id", id++);
|
||||
var tr = _window.document.createElement("treerow");
|
||||
appendCatToTree(elt, tr)
|
||||
appendCatToTree(elt, tr);
|
||||
ti.setAttribute("open", isRoot);
|
||||
ti.appendChild(tr);
|
||||
if (elt.children) {
|
||||
var pch = _window.document.createElement("treechildren");
|
||||
for (var k = 0; k < elt.children.length; k++) {
|
||||
createCellElement(pch, elt.children[k], id, _window, false, type)
|
||||
createCellElement(pch, elt.children[k], id, _window, false, type);
|
||||
}
|
||||
ti.appendChild(pch);
|
||||
}
|
||||
fatherElement.appendChild(ti);
|
||||
} catch (ex) {
|
||||
cout("Can't create cell element: " + ex)
|
||||
cout("Can't create cell element: " + ex);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +70,7 @@ TRACKMENOT.editor = function () {
|
|||
function resetTree (id,_window) {
|
||||
var tree = _window.document.getElementById(id);
|
||||
var removeList = _window.document.getElementsByTagName("treechildren");
|
||||
while( removeList.length!= 0) {
|
||||
while( removeList.length !== 0) {
|
||||
removeList = _window.document.getElementsByTagName("treechildren");
|
||||
for (var i=0; i< removeList.length; i++)
|
||||
tree.removeChild(removeList[i]);
|
||||
|
@ -96,7 +93,8 @@ TRACKMENOT.editor = function () {
|
|||
}
|
||||
|
||||
function getRSSFile() {
|
||||
if (rss_file!= null) return rss_file;
|
||||
if (rss_file !== null)
|
||||
return rss_file;
|
||||
rss_file = TRACKMENOT.utils.getProfileDir().clone();
|
||||
rss_file.append("TRACKMENOT");
|
||||
if( !rss_file.exists() || !rss_file.isDirectory() )
|
||||
|
@ -106,9 +104,9 @@ TRACKMENOT.editor = function () {
|
|||
}
|
||||
|
||||
function getRSSJsonString() {
|
||||
var data = "";
|
||||
try {
|
||||
var file = getRSSFile();
|
||||
var data = "";
|
||||
var fstream = Components.classes["@mozilla.org/network/file-input-stream;1"]
|
||||
.createInstance(Components.interfaces.nsIFileInputStream);
|
||||
var sstream = Components.classes["@mozilla.org/scriptableinputstream;1"]
|
||||
|
@ -134,7 +132,7 @@ TRACKMENOT.editor = function () {
|
|||
|
||||
|
||||
function setIntPreference(prefName,prefValue) {
|
||||
if ( document.getElementById(prefValue) && document.getElementById(prefValue).value!= "" )
|
||||
if ( document.getElementById(prefValue) && document.getElementById(prefValue).value !== "" )
|
||||
this.prefs.setIntPref(prefName,document.getElementById(prefValue).value);
|
||||
}
|
||||
|
||||
|
@ -143,7 +141,7 @@ TRACKMENOT.editor = function () {
|
|||
for each(var elt in father.children ) {
|
||||
if (elt.id == id) result = elt;
|
||||
else result = getObjectByID( id,elt);
|
||||
if( result != null) return result;
|
||||
if( result !== null) return result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -151,9 +149,9 @@ TRACKMENOT.editor = function () {
|
|||
function getFatherByID( id, father ) {
|
||||
var result = null;
|
||||
for each(var elt in father.children ) {
|
||||
if (elt.id == id) result = father;
|
||||
if (elt.id === id) result = father;
|
||||
else result = getFatherByID( id,elt);
|
||||
if( result != null) return result;
|
||||
if( result !== null) return result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -162,7 +160,7 @@ TRACKMENOT.editor = function () {
|
|||
var entr = {};
|
||||
entr.id = val;
|
||||
entr.type = type;
|
||||
entr.children = new Array();
|
||||
entr.children = [];
|
||||
return entr;
|
||||
}
|
||||
|
||||
|
@ -236,11 +234,11 @@ TRACKMENOT.editor = function () {
|
|||
break;
|
||||
case 'category':
|
||||
var cat = getObjectByID(tree_item,rss_obj);
|
||||
cat.children.push(newRSS(entry))
|
||||
cat.children.push(newRSS(entry));
|
||||
break;
|
||||
case 'rss':
|
||||
var cat = getObjectByID(tree_item,rss_obj);
|
||||
cat.children.push(newRSS(entry))
|
||||
cat.children.push(newRSS(entry));
|
||||
break;
|
||||
default :
|
||||
rss_obj.children.push(newCategory(entry,'category'));
|
||||
|
@ -282,7 +280,7 @@ TRACKMENOT.editor = function () {
|
|||
_saveEntryChange: function(old_id) {
|
||||
var obj = getObjectByID(old_id,rss_obj);
|
||||
obj.id = window.document.getElementById('entry-text').value;
|
||||
window.opener.TRACKMENOT.editor._setRSSObj(rss_obj)
|
||||
window.opener.TRACKMENOT.editor._setRSSObj(rss_obj);
|
||||
window.opener.TRACKMENOT.editor._loadTree();
|
||||
return;
|
||||
},
|
||||
|
@ -315,16 +313,16 @@ TRACKMENOT.editor = function () {
|
|||
|
||||
_onFeedPageLoad :function() {
|
||||
new_feed_uri = getFeedURL();
|
||||
if (new_feed_uri != "") {
|
||||
if (new_feed_uri !== "") {
|
||||
cout("Adding new feed: "+ new_feed_uri);
|
||||
openDialog("chrome://trackmenot/content/selectcat.xul", "TrackMeNot RSS Handler","chrome,centerscreen,resizable=yes,width=230,height=250",new_feed_uri)
|
||||
openDialog("chrome://trackmenot/content/selectcat.xul", "TrackMeNot RSS Handler","chrome,centerscreen,resizable=yes,width=230,height=250",new_feed_uri);
|
||||
}
|
||||
return;
|
||||
},
|
||||
|
||||
_onSelectTopicLoad: function(e) {
|
||||
TRACKMENOT.editor._loadCategoryTree();
|
||||
var attributes = new Array ('text')
|
||||
var attributes = new Array ('text');
|
||||
if("arguments" in window && window.arguments.length > 0) {
|
||||
new_feed_uri = window.arguments[0];
|
||||
cout("Selecting a topic for feed: "+ new_feed_uri);
|
||||
|
@ -350,7 +348,7 @@ TRACKMENOT.editor = function () {
|
|||
var foStream = TRACKMENOT.utils.getFoStream();
|
||||
foStream.init(file, 0x02 | 0x08 | 0x20, 0664, 0);
|
||||
var jsonString = JSON.stringify(rss_obj);
|
||||
cout(jsonString)
|
||||
cout(jsonString);
|
||||
foStream.write(jsonString, jsonString.length,'','iso-8859-1');
|
||||
foStream.close();
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue