User:Ciencia Al Poder-fduser/global.js

if (!window.urchinTracker) urchinTracker = function{}; if (!window.__utmSetVar) __utmSetVar = function{}; if (!window.quantserve) quantserve = function{};

if (window.YAHOO && YAHOO.Wikia && YAHOO.Wikia.Tracker && YAHOO.Wikia.Tracker.init) YAHOO.Wikia.Tracker.init = function{};

function addJS(source){ var head = document.getElementsByTagName('head').item(0); var script = document.createElement('script'); script.setAttribute('src', source); script.setAttribute('type', 'text/javascript'); head.appendChild(script); }

var logBox;

function log(message){ if (!window.logBox){ logBox = document.createElement('textarea'); logBox.id = 'logBox'; document.getElementById('bodyContent').appendChild(logBox); }	logBox.value = logBox.value + message + "\n-\n\n"; }

function show_props(objeto, nombreobjeto){ n = nombreobjeto||'o'; var resultado = ""; for (propiedad in objeto){ try{ resultado += n + '.' + propiedad + ' = ' + objeto[propiedad] + '\n'; } catch(e){} }	return resultado; }

/* Evita el envío del formulario al pulsar 'enter' en el resumen */ function anulaSubmitOnEnter{ var input = document.getElementById('wpSummary'); if (!input) return; YAHOO.util.Event._simpleAdd(input, 'keypress', escapeEnterInput, 0); }

function escapeEnterInput(e){ if (e.keyCode == 13){ if (e.preventDefault) e.preventDefault; else e.returnValue = false; } }

/* */ addJS('http://www.telefonica.net/web2/martineznovo/util/edit_area/edit_area_full_with_plugins.js.gz');

function editHighlightLoader{ if (wgAction != 'edit') return; if (window.addPortletLink){ addPortletLink('p-tb', 'javascript:editHighlight;', 'Editor avanzado'); return; }	var t = document.getElementById('toolbar'); if (skin!='monaco' || !t) return; var d = document.createElement('div'); d.className = 'editHighlightBtn'; var a =document.createElement('a'); a.href = 'javascript:editHighlight;'; a.appendChild(document.createTextNode('Editor avanzado')); d.appendChild(a); t.parentNode.insertBefore(d,t); }

function editHighlight(pide){ var syntax = 0; if (!window.disableEditHighlight && editAreaLoader){ if (window.wgPageName && wgPageName.length > 3 && wgPageName.substr(wgPageName.length-3,3) == '.js'){ syntax = 'js'; } else if (window.wgPageName && wgPageName.length > 4 && wgPageName.substr(wgPageName.length-4,4) == '.css'){ syntax = 'css'; } else if (pide){ syntax = prompt('Tipo de sintaxis a aplicar:'); }		if (syntax) editAreaLoader.init({id: 'wpTextbox1', syntax: syntax, start_highlight: 1, language: 'es', display: 'onload' }); else editAreaLoader.init({id: 'wpTextbox1', start_highlight: 0, language: 'es', display: 'onload' }); } }

function addZeroEditSectionLink{ if (wgNamespaceNumber == -1 || wgAction != 'view') return; var s = document.createElement('span'); s.className = 'editsection'; var a = document.createElement('a'); a.href = wgScript + '?title=' + wgPageName + '&action=edit&section=0'; a.title = 'Editar la sección inicial'; a.appendChild(document.createTextNode('editar')); s.appendChild(document.createTextNode('[')); s.appendChild(a); s.appendChild(document.createTextNode(']')); document.getElementById('content').getElementsByTagName('h1')[0].appendChild(s); }

// Ejecutar aquí try{ addOnloadHook(anulaSubmitOnEnter); addOnloadHook(editHighlightLoader); addOnloadHook(addZeroEditSectionLink); }catch(e){ alert('Casque en el onload Global.js'); }