Changes

Jump to navigation Jump to search
1,978 bytes added ,  06:05, 25 July 2017
m
Adding back some useful code
Line 124: Line 124:  
$( createCollapseButtons );
 
$( createCollapseButtons );
 
   
 
   
 +
 +
/** Proper(?) collapsible text **********************************************************/
 +
 +
function doExpandText(textIndex)
 +
{
 +
    var Button=document.getElementById("pcsx2_collapsibleButton"+textIndex);
 +
    if (!Button) return false;
 +
    var TextFull=document.getElementById("pcsx2_collapsibleTextFull"+textIndex);
 +
    if (!TextFull) return false;
 +
    Button.style.display="none";
 +
    TextFull.style.display="";
 +
}
 +
 +
function createCollapseTextButtons()
 +
{
 +
    var MyClasses=document.getElementsByClassName("pcsx2_collapsible_text");
 +
    var textIndex=0;
 +
    var str="";
 +
 +
    for (var i=0;i<MyClasses.length;i++) {
 +
        str=MyClasses[i].innerHTML;
 +
        MyClasses[i].innerHTML=str.replace(/(<p>|<\/p>|<br>|<br\/>|<br \/>)/gmi,"");
 +
 +
        //should contain two spans: pcsx2_collapsible_text_part and pcsx2_collapsible_text_full
 +
        var TextPart=MyClasses[i].getElementsByClassName("pcsx2_collapsible_text_part")[0];
 +
        if (!TextPart) continue;
 +
        var TextFull=MyClasses[i].getElementsByClassName("pcsx2_collapsible_text_full")[0];
 +
        if (!TextFull) continue;
 +
        //creating href
 +
        var Button=document.createElement("span");
 +
        var ButtonLink=document.createElement("a");
 +
        var ButtonText=document.createTextNode("...");
 +
        Button.style.fontWeight="bold";
 +
        Button.style.fontSize="smaller";
 +
        Button.setAttribute("id","pcsx2_collapsibleButton"+textIndex);
 +
        ButtonLink.setAttribute("href","javascript:doExpandText("+textIndex+");");
 +
        ButtonLink.setAttribute("title","Expand this text...");
 +
        ButtonLink.appendChild(ButtonText);
 +
        Button.appendChild(document.createTextNode(" ("));
 +
        Button.appendChild(ButtonLink);
 +
        Button.appendChild(document.createTextNode(")"));
 +
        TextFull.setAttribute("id","pcsx2_collapsibleTextFull"+textIndex);
 +
        TextFull.style.display="none";
 +
        TextPart.appendChild(Button);
 +
        textIndex++;
 +
    }
 +
}
 +
 +
$(createCollapseTextButtons);
 +
 
   
 
   
 
/** Dynamic Navigation Bars (experimental) *************************************
 
/** Dynamic Navigation Bars (experimental) *************************************
67,022

edits

Navigation menu