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 = function{};

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

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 (skin == 'monobook'){ addPortletLink('p-tb', 'javascript:editHighlight;', 'Editor avanzado'); return; }	var t = document.getElementById('toolbar'); if (skin!='monaco' || !t) return; var d = $T.create('div', {className:'editHighlightBtn', style:'float:left; margin-top:20px; margin-left:5px;'}); d.appendChild($T.create('a', {href:'javascript:editHighlight;'}, 'Editor avanzado')); 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 = $T.create('span', {'class':'editsection',style:'float:none;position:absolute;'}); var a = $T.create('a', {href: wgScript+'?title='+wgPageName+'&action=edit&section=0', title:'Editar la sección inicial'}, 'editar'); $T.makeChildren([document.createTextNode('['),a,document.createTextNode(']')],s); (document.getElementById('content')||document.getElementById('article')).getElementsByTagName('h1')[0].appendChild(s); }

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