User:Starlightblunder/prefs.js

/* This code is managed by Pcj. Edits are welcome, but will have to be approved by Pcj (or an admin) before it takes effect for the entire wiki. See Help:Tooltips or contact Pcj for more information.

*/ var tCookie = getCookie("tooltips-visibility"); function toggleTooltip(e) { var script = e.name.substring(3) + ";"; var sv = (e.value == "on" ? "+" : "-") + script; var op = (e.value == "on" ? "-" : "+") + script; if (tCookie.indexOf(sv) == -1) { if (tCookie.indexOf(op) != -1) { tCookie = tCookie.replace(op, sv); } else { tCookie += sv; }	}	setCookie("tooltips-visibility", tCookie, 30); } function getCookieTooltipPref(script, defaultV) { var forceOff = tCookie.indexOf("-" + script + ";") != -1; var forceOn = tCookie.indexOf("+" + script + ";") != -1; return forceOff ? false : (forceOn ? true : defaultV); } function findUnusedPrefPaneId { var minid = 8; while (document.getElementById("prefsection-" + minid) != null) minid++; return minid; } function genTooltipToggle(script, vState, scriptName, scriptDescription) { var cState = getCookieTooltipPref(script, vState); var buffer = " " + scriptName + (scriptDescription != null ? (" " + scriptDescription + " ") : '') + " " + "On " + "Off "; if (cState != vState)	buffer += ' Warning: Set to '+(vState ? 'ON' : 'OFF')+' by custom JS. ';	return buffer + ' '; }

var prefPaneId = findUnusedPrefPaneId; fieldLinks = document.getElementById("preftoc"); newListEntry = document.createElement("li"); newFieldLink = document.createElement("a"); newFieldLink.setAttribute("href", "#prefsection-" + prefPaneId); newFieldLink.secid = "prefsection-" + prefPaneId; newFieldLink.onclick = newFieldLink.onmousedown = uncoversection; newFieldLink.textContent = "Tooltips"; newListEntry.insertBefore(newFieldLink, newListEntry.lastChild); fieldLinks.appendChild(newListEntry);

prefFields = document.getElementsByTagName("fieldset"); newField = document.createElement("fieldset"); newField.style.display = "none"; newField.setAttribute("class", "prefsection"); newField.setAttribute("id", "prefsection-" + prefPaneId); newLegend = document.createElement("legend"); newLegend.setAttribute("class", "mainLegend"); newLegend.textContent = "Tooltips"; fieldsParent = prefFields[prefFields.length - 1].parentNode; newField.insertBefore(newLegend, newField.firstChild); newField.innerHTML += 'Change which tooltips, if any, are displayed on the wiki. Changes are applied immediately, and persist for 30 days. '; var tSettings = " '; fieldsParent.insertBefore(newField, prefFields[prefFields.length - 1].nextSibling);

/* */