Welcome to IOPWiki, Commander.
We are searching for new editors to keep track of Girls' Frontline 2 content, as well as veteran players to complete existing Girls' Frontline and Project Neural Cloud articles.
You can contribute without an account. Learn how to contribute and join our Discord server.

MediaWiki:Gadget-artTab.js: Difference between revisions

Welcome to IOP Wiki. This website is maintained by the Girls' Frontline community and is free to edit by anyone.
Jump to navigation Jump to search
Pianoforte (talk | contribs)
No edit summary
Pianoforte (talk | contribs)
No edit summary
Line 1: Line 1:


 
RLQ.push(function () {
$(document).ready(function() {  
$(document).ready(function() {  


Line 32: Line 32:
document.getElementById("defaultArtTab").click();
document.getElementById("defaultArtTab").click();
     }
     }
});
});
});

Revision as of 07:35, 26 December 2017

RLQ.push(function () {
$(document).ready(function() { 

	function artTabSwitch(evt, artTabName) {
	    var i, tabcontent, tablinks;
	    tabcontent = document.getElementsByClassName("artTabContent");
	    for (i = 0; i < tabcontent.length; i++) {
	        tabcontent[i].style.display = "none";
	    }
	    tablinks = document.getElementsByClassName("artTabLinks");
	    for (i = 0; i < tablinks.length; i++) {
	        tablinks[i].className = tablinks[i].className.replace(" active", "");
	    }
	    document.getElementById(artTabName).style.display = "block";
	    evt.currentTarget.className += " active";
	}


    if (document.getElementById("artTab")) {
		var artTabDiv = document.getElementById("artTab");
		console.log(artTabDiv);
		buttonsStr =   '<div style="position:absolute;top:0;left:0">' +
                       '<button class="artTabLinks" id="defaultArtTab" onclick="artTabSwitch(event, \'fullart\')">Normal</button>' +
                       '<button class="artTabLinks" onclick="artTabSwitch(event, \'fullart_D\')">Damaged</button>' +
                    '</div>';
        
        if (document.getElementById ("defaultArtTab") === null)  { 
	    	artTabDiv.insertAdjacentHTML( 'afterbegin', buttonsStr);
        }

	document.getElementById("defaultArtTab").click();
    }
});
});