За последние 24 часа нас посетили 17728 программистов и 1659 роботов. Сейчас ищут 915 программистов ...

нужна помощь в дописание скрипта

Тема в разделе "JavaScript и AJAX", создана пользователем vovka1021, 6 дек 2011.

  1. vovka1021

    vovka1021 Активный пользователь

    С нами с:
    3 дек 2011
    Сообщения:
    2
    Симпатии:
    0
    помогите как из
    var logo = str[4];
    вызвать
    logo.png


    [js]function init()
    {
    ListOfSkins();

    ReadStations(System.Gadget.Settings.read("stationName"),System.Gadget.Settings.read("stationStream"));
    AutoReconnect.checked = System.Gadget.Settings.read("AutoReconnect");

    System.Gadget.onSettingsClosing = SettingsClosing;

    }

    function SettingsClosing(event)
    {
    if (event.closeAction == event.Action.commit)
    {
    System.Gadget.Settings.write("stationURL", StationsList.options[StationsList.selectedIndex].value);
    var stationName_str = StationsList.options[StationsList.selectedIndex].text;
    var stationName = stationName_str.substring(stationName_str.indexOf('. ') + 2, stationName_str.lastIndexOf(' - '));
    System.Gadget.Settings.write("stationName", stationName);

    var stationWeb = stationName_str.substring(stationName_str.lastIndexOf(' - ') + 3, stationName_str.length);
    System.Gadget.Settings.write("stationWeb", stationWeb);

    System.Gadget.Settings.write("stationStream", StationBitrate.value);

    System.Gadget.Settings.write("skin", SkinList.options[SkinList.selectedIndex].value);

    System.Gadget.Settings.write("AutoReconnect", AutoReconnect.checked);
    }
    event.cancel = false;
    }

    function ReadStations(statname,statstream)
    {

    var fs = new ActiveXObject("Scripting.FileSystemObject");
    var ts = fs.OpenTextFile(System.Gadget.path + "\\" + "\\stations.txt", 1, -1);
    var ini = "";
    ini = ts.ReadAll();
    ts.Close();

    var lines = ini.split('\n');
    var lineCount = lines.length;

    var n = 0;
    var count = 1;
    var sel = document.getElementById('StationsList');
    var selbit = document.getElementById('StationBitrate');

    while (n < lineCount-1) {

    var str = lines[n];
    str = str.replace("\r","");

    var str = str.split('|');
    var url = str[0];
    var name = str[1];
    var logo = str[4];

    var str2 = lines[n+1];
    str2 = str2.replace("\r","");
    var str2 = str2.split('|');
    var name2 = str2[1];

    if (name != name2)
    {

    var opt = document.createElement("option");
    opt.value = url;
    opt.innerHTML = str[4]+ " " +count + ". " + name + " - " + str[3];

    if (str[3].search(/------/) > -1) {
    var opt = document.createElement("optgroup");
    opt.label = str[3];
    opt.disabled = true;
    sel.appendChild(opt);
    count--;
    }


    if (statname == name) {
    opt.selected = true;

    for (i = 0; i < lineCount-1; i++) {
    var str3 = lines;
    str3 = str3.replace("\r","");
    str3 = str3.split('|');
    if (str3[1] == name) {
    var optbit = document.createElement("option");
    optbit.value = str3[2];
    optbit.innerHTML = str3[2];
    if (statstream == str3[2]) optbit.selected = true;
    if (statstream == 0) optbit.selected = true;
    selbit.appendChild(optbit);
    }
    }

    }

    sel.appendChild(opt);
    count++;
    }

    n++;
    }

    //StationCounter.innerText = "[" + (count - 1) + "]"; выбор станции количество []

    }

    function onChangeStation()
    {
    ClearOptionsFast("StationBitrate");

    var stationName_str = StationsList.options[StationsList.selectedIndex].text;
    var stationName = stationName_str.substring(stationName_str.indexOf('. ') + 2, stationName_str.lastIndexOf(' - '));

    ReadStations(stationName,0);

    }

    function ClearOptionsFast(id)
    {
    var selectObj = document.getElementById(id);
    var selectParentNode = selectObj.parentNode;
    var newSelectObj = selectObj.cloneNode(false);
    selectParentNode.replaceChild(newSelectObj, selectObj);

    }

    function ListOfSkins()
    {
    var DataArr = [];
    var fso, f, f1, fc;
    var count = 0;
    fso = new ActiveXObject("Scripting.FileSystemObject");
    f = fso.GetFolder(System.Gadget.path + "\\images\\skin");
    fc = new Enumerator(f.files);
    for (; !fc.atEnd(); fc.moveNext())
    DataArr.push({"Key":fc.item().ShortName});

    var sklist = document.getElementById('SkinList');
    for (i = 0; i < DataArr.length; i++ )
    {
    var option = document.createElement("OPTION");
    option.value = DataArr.Key;
    option.innerText = DataArr.Key.substring(0, DataArr.Key.lastIndexOf('.'));
    if (System.Gadget.Settings.read('skin') == DataArr.Key) { option.selected = true;
    bg.src = "images/skin/" + System.Gadget.Settings.read("skin");
    }
    sklist.appendChild(option);
    }

    }

    function StationList()
    {
    System.Shell.execute(System.Gadget.path + '\\' + '\\stations.txt');
    }

    function setTheme()
    {
    bg.src = "images/skin/" + SkinList.options[SkinList.selectedIndex].value;
    }[/js]