lunes, 23 de marzo de 2009

AAP Bloque T1.8 ejercicio1:

Hacer un script JS que navegue desde cada bloque de ejercicios al siguiente.

// ==UserScript==
// @name AAP-Nav2
// @namespace http://geneura.org/projects/greasemonkey
// @description Navegacion por los ejercicios de AAP
// @include http://geneura.ugr.es/~jmerelo/asignaturas/AAP/*
// ==/UserScript==

GM_log('Entrando AAP-Nav2');
var ej = document.getElementsByClassName('ejercicios');
var a_nodes = new Array;
var anchors = new Array;
for ( var secs = 0; secs < ej.length; secs ++ ) {
var id = ej[secs].getAttribute('id');
var thisA = document.createElement('a');
thisA.setAttribute('href',id);
a_nodes[secs] = thisA;
anchors[secs] = thisA.getAttribute('href');
GM_log('Anchor ' + secs + " " + anchors[secs]);
}



for ( var secs = 0; secs < ej.length; secs ++ ) {
var span = document.createElement('span');
span.setAttribute('style','background:lightgreen');
if ( secs > 0 ) {
var ahref = document.createElement('a');
ahref.setAttribute('href','#'+anchors[secs-1]);
var txt=document.createTextNode('^');
ahref.appendChild(txt);
span.appendChild(ahref);
}
if ( secs < ej.length -1 ) {
span.appendChild(document.createTextNode(' | '));
var ahref = document.createElement('a');
ahref.setAttribute('href','#'+anchors[secs+1]);
var txt=document.createTextNode('v');
ahref.appendChild(txt);
span.appendChild(ahref);
}
ej[secs].appendChild(a_nodes[secs]);
a_nodes[secs].parentNode.insertBefore(span,a_nodes[secs]);
}




1 comentario:

  1. MZ was responsible for data administration, data cleaning, and data analysis. RV offered overall leadership for the research properly as|in addition to} oversight of the survey design, implementation, and analysis. Schwartz DG. How casinos use math to earn cash whenever you play 메리트카지노 the slots, in Forbes; 2018. Table2 examines the relationship between regular playing involvement and depth of playing estimated by money spent on playing and maximum frequency over the past year .

    ResponderEliminar