Bruger:Mads Haupt/sandkasse.js
Bemærk, efter at have gemt, er du almindeligvis nødt til at tømme din browsers cache for at kunne se ændringerne.
Mozilla/Firefox/Safari/Konqueror: Hold shifttasten nede og klik på reload eller tryk på ctrl-shift-r
Internet Explorer: Ctrl-F5
Opera: F5
Safari til Mac: ⌥⌘E
Mozilla/Firefox/Safari/Konqueror: Hold shifttasten nede og klik på reload eller tryk på ctrl-shift-r
Internet Explorer: Ctrl-F5
Opera: F5
Safari til Mac: ⌥⌘E
// alert("Dette er en streng og her er ingenting '"+undefined+"'");
// alert(33==57?"Sandt":("Falsk"=="Falsk"?"Det er sandt at det er falsk":"Det er ikke sandt at det er falsk"));
/* try {
alert(JSON.stringify(Node));
alert(typeof Node);
var testnode = new Node("<div>Dette er indholdet</div>");
alert(testnode.innerHTML);
}
catch(err) {
alert(err);
} */
// alert(JSON.stringify(mw));
// alert(Object.keys(mw.config).length.toString());
var element = document.getElementById("dettediv");
if (element !== null && element !== undefined) {
document.getElementById("dettediv").parent.insertbefore(document.createTextNode(mw.config.get("wgUser")), document.getElementById("dettediv"));
}
document.insertDetails=function(content, view, place) {
try {
if (document.templatedetailscount===undefined) {
document.templatedetailscount = 1;
}
else {
document.templatedetailscount += 1;
}
var contentcss_display = "display:none;";
// var contentcss_displayanimation = "";
// var contentcss_hideanimation = "";
var button_text = "Vis";
if (document.templatedetailsview===undefined) {
document.templatedetailsview = [false];
}
else {
document.templatedetailsview[document.templatedetailscount] = false;
}
if (view===true) {
contentcss_display = "";
button_text = "Skjul";
document.templatedetailsview[document.templatedetailscount] = true;
}
// place.innerHTML = '<div style="background-color: gray; width: 73px; border-radius: 5px;" id="templatedetails_button_'+document.templatedetailscount+'" onClick="document.template_changedetails('+document.templatedetailscount+')"><center>'+button_text+'</center></div><br /><div id="templatedetails_content_'+templatedetailscount+'" style="'+contentcss_display+'>'+content+'</div>';
// place.id = "templatedetails_"+templatedetailscount;
// place.setAttribute("style", "background-color: gray; width: 73px; border-radius: 5px; moz-border-radius: 5px; webkit-border-radius: 5px;");
place.setAttribute("style", "overflow: hidden;"+contentcss_display);
place.setAttribute("id", "templatedetails_content_"+document.templatedetailscount);
var templatedetails_button_node = document.createElement("div");
templatedetails_button_node.setAttribute("style", "background-color: gray; width: 73px;"+(document.supportedBorderRadius!==undefined?" "+document.supportedBorderRadius+": 5px;":""));
templatedetails_button_node.setAttribute("id", "templatedetails_button_"+document.templatedetailscount);
templatedetails_button_node.setAttribute("onClick","document.template_changedetails("+document.templatedetailscount+")");
templatedetails_button_node.innerHTML = "<center>"+button_text+"</center>";
place.parentNode.insertBefore(templatedetails_button_node, place);
}
catch (err) {
alert(err);
}
};
document.template_changedetails=function(number) {
if (document.templatedetailsview[number]) {
var templatedetails_content_element = document.getElementById("templatedetails_content_"+number);
document.templatedetailsview[number] = false;
// templatedetails_content_element.style.display="none";
if (document.browsersupportanimation_templatedetails) {
var hideanimation = "templatedetails 5s ease 0s 1 normal none running";
if (templatedetails_content_element.style.animation!==undefined) {
templatedetails_content_element.style.animation = hideanimation;
}
else if (templatedetails_content_element.style.WebkitAnimation!==undefined) {
templatedetails_content_element.style.WebkitAnimation = hideanimation;
}
else if (templatedetails_content_element.style.MozAnimation!==undefined) {
templatedetails_content_element.style.MozAnimatiom = hideanimation;
}
else {
alert("err");
}
}
document.getElementById("templatedetails_button_"+number).innerHTML="<center>Vis</center>";
}
else {
var templatedetails_content_element = document.getElementById("templatedetails_content_"+number);
document.templatedetailsview[number] = true;
// templatedetails_content_element.style.display="";
if (document.browsersupportanimation_templatedetails) {
var viewanimation = "5s reverse templatedetails";
if (templatedetails_content_elememt.style.animation!==undefined) {
templatedetails_content_element.style.animation = viewanimation;
}
else if (templatedetails_content_element.style.WebkitAnimation!==undefined) {
templatedetails_content_element.style.WebkitAnimation = viewanimation;
}
else if (templatedetails_content_element.style.MozAnimation!==undefined) {
templatedetails_content_element.style.MozAnimation = viewanimation;
}
else {
alert("err");
}
}
document.getElementById("templatedetails_button_"+number).innerHTML="<center>Skjul</center>";
}
};
var templatedetails = document.getElementsByClassName("templatedetails");
alert(templatedetails.length);
try {
for (i=0;i<templatedetails.length;i++) {
var currenttemplatedetails = templatedetails[i];
if (i===0) {
document.browsersupportanimation_templatedetails = (currenttemplatedetails.style.animation!==undefined||currenttemplatedetails.style.WebkitAnimation!==undefined||currenttemplatedetails.style.MozAnimation!==undefined)&¤ttemplatedetails.style.opacity!==undefined;
// document.supportedAnimationCSS = currenttemplatedetails.style.animation!==undefined?"animation":(currenttemplatedetails.style.WebkitAnimation!==undefined?"-webkit-animation":(currenttemplatedetails.style.MozAnimation?"-moz-animation":undefined));
document.supportedBorderRadius = currenttemplatedetails.style.borderRadius!==undefined?"border-radius":(currenttemplatedetails.style.WebkitBorderRadius!==undefined?"-webkit-border-radius":(currenttemplatedetails.style.MozBorderRadius!==undefined?"-moz-border-radius":undefined));
alert(document.browsersupportanimation_templatedetails);
}
var viewvalue = false;
var template_view_attribute = currenttemplatedetails.getAttribute("template_view");
if (template_view_attribute!==null&&template_view_attribute!==undefined) {
if (currenttemplatedetails.getAttribute("template_view").toLower=="true") {
viewvalue = true;
}
}
document.insertDetails(currenttemplatedetails.innerHTML,viewvalue,currenttemplatedetails);
}
}
catch (err) {
alert(err);
}