Skip to content

Commit

Permalink
XML parsing mechanism in matches.js needed to be changed due to the p…
Browse files Browse the repository at this point in the history
…revious commit.

git-svn-id: https://foxtrick.googlecode.com/svn/trunk@143 1e3807c3-0949-0410-b78e-337b627472c1
  • Loading branch information
kkolman committed Dec 15, 2008
1 parent e8eb407 commit 2102725
Showing 1 changed file with 30 additions and 22 deletions.
52 changes: 30 additions & 22 deletions content/shortcuts_and_tweaks/matches.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
/**
* matches.js
* adds info on matches page
* @author taised
*/
////////////////////////////////////////////////////////////////////////////////
var Matches = {
/**
* matches.js
* adds info on matches page
* @author taised
*/
////////////////////////////////////////////////////////////////////////////////
var Matches = {

MODULE_NAME : "Matches",
MODULE_NAME : "Matches",
MODULE_CATEGORY : "shortcutsandtweaks",
htLanguagesXml : null,
htCurrenciesXml : null,
ratingDefs : {},

init : function() {
Foxtrick.registerPageHandler( 'match',

init : function() {
Foxtrick.registerPageHandler( 'match',
Matches );
this.initHtLang();
this.initHtRatings();
},

this.initHtRatings();
},

run : function( page, doc ) {
try {
var sidebar = doc.getElementById('sidebar');
Expand Down Expand Up @@ -107,7 +107,7 @@ var Matches = {
} catch (e) {
this.LOG('matches.js run: '+e);
}


},

_createBarDiv: function(doc, percentArray, strangediv) {
Expand Down Expand Up @@ -250,22 +250,30 @@ var Matches = {
initHtLang: function ()
{
try {
this.htLanguagesXml = document.implementation.createDocument("", "", null);
this.htLanguagesXml.async = false;
this.htLanguagesXml.load("chrome://foxtrick/content/htlocales/htlang.xml", "text/xml");
this.htLanguagesXml = this._loadXmlIntoDOM("chrome://foxtrick/content/htlocales/htlang.xml");
} catch (e) {
this.LOG('matches.js initHtLang: '+e);
}

try {
this.htCurrenciesXml = document.implementation.createDocument("", "", null);
this.htCurrenciesXml.async = false;
this.htCurrenciesXml.load("chrome://foxtrick/content/htlocales/htcurrency.xml", "text/xml");
this.htCurrenciesXml = this._loadXmlIntoDOM("chrome://foxtrick/content/htlocales/htcurrency.xml");
} catch (e) {
this.LOG('matches.js initHtLang: '+e);
}
},

_loadXmlIntoDOM: function(url) {
var req = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance();
req.open("GET", "chrome://foxtrick/content/htlocales/htlang.xml", false);
req.send(null);
var doc = req.responseXML;
if (doc.documentElement.nodeName == "parsererror") {
this.LOG("error parsing " + url);
return null;
}
return doc;
},

LOG: function (msg) {
var consoleService = Components.classes["@mozilla.org/consoleservice;1"]
.getService(Components.interfaces.nsIConsoleService);
Expand Down Expand Up @@ -504,5 +512,5 @@ var Matches = {

}
};
}
}
};

0 comments on commit 2102725

Please sign in to comment.