home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
GameStar 2006 February
/
Gamestar_81_2006-02_dvd.iso
/
Programy
/
mcombo152.exe
/
Plugin
/
Weather
/
script
/
configuration.js
next >
Wrap
Text File
|
2005-11-15
|
5KB
|
175 lines
/*************************************************************************************
=== Weather 4.41 ===
By Neo101
Previous versions by crino, Arkim, mdlist, seidenj and Tara
Created for Maxthon Tabbed Browser (www.maxthon.com)
=== License ===
Please contact Neo10 on forum.maxthon.com or www.neo101.nl if you would like to make any changes!
This plugin is for Maxthon only. You are not allowed to use it for any other program without permission.
Do not remove these comments/credits.
You are allowed to use/copy the icons. I did not create them.
Copyright 2005
Last modified 17-11-2005
=== Description of configuration.js ===
Here are the functions used by the configuration
***************************************************************************************/
/* Parse the XML file with search results */
function xmlParse(xmlText) {
var nodes = new Array()
try{
var xmlDoc = external.max_activex(SECURITY_ID,"Microsoft.XMLDOM")
}
catch(err) {
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM")
}
xmlDoc.async = "false"
xmlDoc.loadXML(xmlText)
var ch=xmlDoc.documentElement.childNodes
for(i=0; i<ch.length; i++){
nodes[i] = new Array()
nodes[i][0] = ch.item(i).text
nodes[i][1] = ch.item(i).getAttribute("id")
}
return nodes
}
/* Clear/Add rows for the city search */
function clearRows(oTable) {
var rowsnum = oTable.rows.length
for(i=0; i<rowsnum; i++) oTable.deleteRow()
}
function addRow(oTable,rowHTML) {
var oRow = oTable.insertRow()
var oCell= oTable.rows(oRow.rowIndex).insertCell(oRow.cells.length)
oCell.innerHTML = rowHTML
}
/* Search for Cities */
function findlocationId() {
var name = document.all['citynameinp'].value
if(name.search(/[a-zA-Z]{4}[0-9]{4}/g)!=-1) {
writeIni("LocationCode"+activeLocation, name)
writeIni("LocationTxt"+activeLocation,'unknown')
location.replace("weather.htm")
return
} else if(name=='') {
clearRows(resultcontent)
addRow(resultcontent,trans('WT_NoKeywords'))
return
}
name = transCity(name.toLowerCase())
var scriptURL = WEBPAGE_LOCATION_SEARCH + name
retrieveHTML(scriptURL)
}
/* Confirm the city after a search */
function confirmcity() {
var sel = 0
if(cities.length==1 && listcities.checked) {
writeIni("LocationCode"+activeLocation, cities[0][1])
writeIni("LocationTxt"+activeLocation, cities[0][0])
locationId=cities[0][1]
sel = 1
} else if(cities.length>1){
for(i=0; i<cities.length; i++) {
if(listcities[i].checked) {
writeIni("LocationCode"+activeLocation, cities[i][1])
writeIni("LocationTxt"+activeLocation, cities[i][0])
locationId=cities[i][1]
sel = 1
}
}
}
if(sel==1) {
document.all['cityNameDisp'].innerHTML=transLoc(readIni("LocationTxt"+activeLocation))
clearRows(resultcontent)
document.all['citynameinp'].value=''
addRow(resultcontent,'<b>'+trans('WT_Saved')+'</b>')
//location.reload()
}
}
/* Set the correct settings*/
function setPara() {
var inputTags=document.all.tags('INPUT');
for (var i=0; i<inputTags.length; i++) {
if(inputTags[i].type=='radio' && inputTags[i].checked) writeIni(inputTags[i].name,inputTags[i].value)
}
var selectTags=document.all.tags('SELECT');
for (var i=0; i<selectTags.length; i++) {
writeIni(selectTags[i].name,selectTags[i].options[selectTags[i].selectedIndex].value)
}
location.replace("weather.htm")
}
/* read the correct settings on start */
function readPara() {
var inputTags = document.all.tags('INPUT');
for (var i=0; i<inputTags.length; i++) {
if(inputTags[i].type == 'radio') {
var iniValue = readIni(inputTags[i].name)
if(inputTags[i].value == iniValue) inputTags[i].checked=true
else inputTags[i].checked=false
}
}
var selectTags = document.all.tags('SELECT');
for (var i=0; i<selectTags.length; i++) {
var iniValue = readIni(selectTags[i].name)
for(var d=0; d<selectTags[i].options.length; d++) {
if(iniValue == selectTags[i].options[d].value) selectTags[i].selectedIndex = d
}
}
document.all['cityNameDisp'].innerHTML = transLoc(activeCityName)
ExpandCollapse("titleadvanced")
ExpandCollapse("titlehelp")
if(languageFile=='0002'||languageFile=='0016') {
document.body.style.direction='RTL'//set the text alignment for the Arabic and Hebrew languagefiles to right to left
}
}
function EnterKeyPress() {
if (window.event.keyCode == 13) findlocationId();
}
/* Read the icon sets available in the icons.ini file, and print the select tag */
function getIconSets(){
var text = ''
for(var i=1; i<10; i++){
var iconLoc = eval('readIniIcon("icon'+i+'")')
var iconName= eval('readIniIcon("iconName'+i+'")')
if(iconLoc!='') text += '<option value="'+iconLoc+'">'+trans("WT_Type")+' '+iconName+'</option>'
else break
}
document.write(text)
}
function readIniIcon(key){
return external.m2_readIni(SECURITY_ID,PLUGIN_NAME,"icons.ini","IconSets", key, '')
}
/* Prints the info+explanation for the settings in the configuration */
function printHead(name){
document.write('<tr class="config-tr" title="'+trans('WT_Explain_'+name)+'">'+
'<td class="head">'+trans('WT_'+name)+'</td>')
}