No al cierre de webs
ShareCode
Permalink: http://www.treeweb.es/u/974/ 01/02/2011

ShareCode

1 // Include highlight from: http://softwaremaniacs.org/media/soft/highlight/highlight.pack.js2 3 var index = null;4 5 window.addEventListener('load', function(e) {6 7  loadCSS('http://softwaremaniacs.org/media/soft/highlight/styles/googlecode.css');8  loadCSS('http://www.treeweb.es/ShareCode/preview/d6cbe1c64c275d6fd18946ed8ced2207/css');9 10  loadJS('http://softwaremaniacs.org/media/soft/highlight/highlight.pack.js', function(e) {11  processALL();12  });13  14  15 }, true);16 17 function processALL() {18  traverseDOM(document.body, function(item) {19  var tagName = item.tagName;20  switch (tagName) {21  case 'CODE': processCODE(item); break;22  }23  });24 };25 26 function processCODE(item) {27  28  var frame = document.createElement('div');29  frame.className = 'code-frame';30  item.parentNode.insertBefore(frame, item);31  32  var title = document.createElement('div');33  title.className = 'code-title';34  frame.appendChild(title);35  36  var pre = document.createElement('pre');37  pre.appendChild(item);38  frame.appendChild(pre);39  40  hljs.highlightBlock(item, null, false);41  title.innerHTML = item.getAttribute('class');42 };43 44 function traverseDOM(item, callback) {45  var children = item.children;46  for (var i=0; i<children.length; i++) {47  traverseDOM(children[i], callback);48  }49  callback(item);50 }51 52 53 54 function loadJS(url, callback) {55  var script = document.createElement('script');56  script.setAttribute('type', 'text/javascript');57  script.setAttribute('src', url);58  if (callback) {59  script.addEventListener('load', callback, true);60  }61  document.head.appendChild(script);62 }63 64 function loadCSS(url, callback) {65  var link = document.createElement('link');66  link.setAttribute('rel', 'stylesheet');67  link.setAttribute('type', 'text/css');68  link.setAttribute('title', 'default');69  link.setAttribute('href', url);70  if (callback) {71  link.addEventListener('load', callback, true);72  }73  document.head.appendChild(link);74 }


Este ShareCode tiene versiones:
  1. DocuSS v0.1 ¿Qué es? Hoja de estilo... (26/08/2013)
Enlace
El enlace para compartir es: