code
stringlengths
1
2.08M
language
stringclasses
1 value
var searchData= [ ['back_2ejava',['Back.java',['../_back_8java.html',1,'']]], ['button_2ejava',['Button.java',['../_button_8java.html',1,'']]] ];
JavaScript
var searchData= [ ['maderapuas',['MaderaPuas',['../class_madera_puas.html',1,'']]], ['maderita',['Maderita',['../class_maderita.html',1,'']]], ['maderota',['Maderota',['../class_maderota.html',1,'']]] ];
JavaScript
var searchData= [ ['score2',['Score2',['../class_score2.html',1,'']]], ['simpletimer',['SimpleTimer',['../class_simple_timer.html',1,'']]] ];
JavaScript
var searchData= [ ['yanoestacaja',['yaNoEstaCaja',['../class_maderota.html#ad579114bf6596692f2d78864a3643551',1,'Maderota']]] ];
JavaScript
var searchData= [ ['score2',['Score2',['../class_score2.html',1,'Score2'],['../class_score2.html#abfc2a3f86bbadbb5103cc0c67bb2abcf',1,'Score2.Score2()']]], ['score2_2ejava',['Score2.java',['../_score2_8java.html',1,'']]], ['seencuentraglobo',['seEncuentraGlobo',['../class_globito.html#a6dc4dee7fe0230442539a98e5c9dc640',1,'Globito']]], ['seencuetraobstaculo',['seEncuetraObstaculo',['../class_obstaculo.html#a2e60e2ab931dd7e5a0e7f70d14639fc6',1,'Obstaculo.seEncuetraObstaculo()'],['../class_portador.html#ac5937b88b5e49d58724521393c903671',1,'Portador.seEncuetraObstaculo()']]], ['siguesubiendopat',['sigueSubiendoPat',['../class_patricio.html#ab970af130120f6224789db1a4801ce13',1,'Patricio']]], ['simpletimer',['SimpleTimer',['../class_simple_timer.html',1,'']]], ['simpletimer_2ejava',['SimpleTimer.java',['../_simple_timer_8java.html',1,'']]], ['sipiedritaencuentracaja',['siPiedritaEncuentraCaja',['../class_piedrita.html#a0fa641a574af495e2b2a8f6890f4fd22',1,'Piedrita']]], ['sipiedritaencuentramaderita',['siPiedritaEncuentraMaderita',['../class_piedrita.html#adf72d40a56131fc132e4e105f9be7fb4',1,'Piedrita']]], ['subir',['subir',['../class_objeto_sube.html#a4b5d4e87c960bf12629b81cef955a8fa',1,'ObjetoSube.subir()'],['../class_objeto_sube.html#a21b0c98372c740fe0237c6634cd6d581',1,'ObjetoSube.subir(int unDato)']]] ];
JavaScript
var searchData= [ ['records_2ejava',['Records.java',['../_records_8java.html',1,'']]], ['recorduser_2ejava',['RecordUser.java',['../_record_user_8java.html',1,'']]] ];
JavaScript
var searchData= [ ['noseencuetraglobo',['noSeEncuetraGlobo',['../class_patricio.html#aa82101df7af4858fb5f5f1b1bcac342d',1,'Patricio']]] ];
JavaScript
var searchData= [ ['eliminaleglobo',['eliminaleGlobo',['../class_patricio.html#a9e112dd1e63dd0316a97e1b9ec56aa6b',1,'Patricio']]], ['encuentralindonopal',['encuentraLindoNopal',['../class_globito.html#aed55cd95e3cf68c1d77b85a158243a5f',1,'Globito']]], ['encuentramaderita',['encuentraMaderita',['../class_globito.html#ae9f1420533cae06335311af15b53ce5b',1,'Globito']]], ['espinasvamostodosjuntos',['espinasVamosTodosJuntos',['../class_cactusder.html#af88406db8e80577654b3e3229d74628b',1,'Cactusder.espinasVamosTodosJuntos()'],['../class_cactusizq.html#a7e840ee1f1c78c08a100a3efced2d869',1,'Cactusizq.espinasVamosTodosJuntos()'],['../class_disparo.html#a6f949a9d961657af51875b0cca5e09da',1,'Disparo.espinasVamosTodosJuntos()']]], ['espinitamepego',['espinitaMePego',['../class_piedrita.html#a2e12f9694203bd1e0aeb148b7664366a',1,'Piedrita']]] ];
JavaScript
var searchData= [ ['maderacae',['maderaCae',['../class_maderota.html#a7e87571ca7fbd98acaa8bb262d1820e0',1,'Maderota']]], ['maderapuas',['MaderaPuas',['../class_madera_puas.html',1,'']]], ['maderapuas_2ejava',['MaderaPuas.java',['../_madera_puas_8java.html',1,'']]], ['maderita',['Maderita',['../class_maderita.html',1,'']]], ['maderita_2ejava',['Maderita.java',['../_maderita_8java.html',1,'']]], ['maderota',['Maderota',['../class_maderota.html',1,'']]], ['maderota_2ejava',['Maderota.java',['../_maderota_8java.html',1,'']]], ['mark',['mark',['../class_simple_timer.html#abe5debfac2280fc4f432a496393ddfe8',1,'SimpleTimer']]], ['meencontreunacaja',['meEncontreUnaCaja',['../class_maderota.html#a48e7fa54c93dc02c1e1518ce734bc646',1,'Maderota']]], ['meencontreungloboloponcho',['meEncontreUnGloboLoPoncho',['../class_globito.html#a5477a2c09fbbeb77da5c7178d6cfc051',1,'Globito']]], ['metocounraton',['meTocoUnRaton',['../class_cajas.html#aca41fdb754ba69a3b57fec5cc53f110b',1,'Cajas.meTocoUnRaton()'],['../class_portador.html#a91fca9c9d44b7313a09273c8062584c4',1,'Portador.meTocoUnRaton()']]], ['milliselapsed',['millisElapsed',['../class_simple_timer.html#abe6ae784edd29f6ab2e29da7b7ea0b1b',1,'SimpleTimer']]], ['muestraletrero',['muestraLetrero',['../class_letrero.html#ac3a506f2181a857a512dc4c59b1c4777',1,'Letrero']]], ['muestrapuntaje',['muestraPuntaje',['../class_score2.html#aad1d2accb6f42a7bbb0de01c0c13078b',1,'Score2']]], ['mueve',['mueve',['../class_globito.html#a8d7e41001ec04be905233ed89e08c5dd',1,'Globito.mueve()'],['../class_objeto_sube.html#a7de738f515da8d3a587cd5e499aa35d0',1,'ObjetoSube.mueve()'],['../class_patricio.html#a6f27deb467412bc033067767d18b06fa',1,'Patricio.mueve()']]], ['muevex',['mueveX',['../class_obstaculo.html#a694b3e6131e32db73eadf807f3dc9519',1,'Obstaculo']]] ];
JavaScript
var searchData= [ ['damepuntaje',['damePuntaje',['../class_score2.html#aefbbeb7093f17f0d2eecbf3a5a0412a8',1,'Score2']]], ['decrementapuntaje',['decrementaPuntaje',['../class_score2.html#a561cc012e4db409856ada84ca032ea96',1,'Score2']]], ['detenpatricio',['detenPatricio',['../class_patricio.html#a428b9470ccc8f8e6d98d334afa86afa1',1,'Patricio']]], ['disparader',['disparaDer',['../class_espina.html#ad8a70b88b64446fe69f9f052b08399bb',1,'Espina']]], ['disparaizq',['disparaIzq',['../class_espina.html#a57eb765d3fb52d2c408f765fc9d6017f',1,'Espina']]] ];
JavaScript
var searchData= [ ['cactus_2ejava',['Cactus.java',['../_cactus_8java.html',1,'']]], ['cactusder_2ejava',['Cactusder.java',['../_cactusder_8java.html',1,'']]], ['cactusizq_2ejava',['Cactusizq.java',['../_cactusizq_8java.html',1,'']]], ['caja1_2ejava',['Caja1.java',['../_caja1_8java.html',1,'']]], ['caja2_2ejava',['Caja2.java',['../_caja2_8java.html',1,'']]], ['cajas_2ejava',['Cajas.java',['../_cajas_8java.html',1,'']]] ];
JavaScript
var searchData= [ ['records',['Records',['../class_records.html',1,'']]], ['recorduser',['RecordUser',['../class_record_user.html',1,'']]] ];
JavaScript
var searchData= [ ['disparo_2ejava',['Disparo.java',['../_disparo_8java.html',1,'']]] ];
JavaScript
var searchData= [ ['letrero',['Letrero',['../class_letrero.html',1,'']]] ];
JavaScript
var searchData= [ ['maderapuas_2ejava',['MaderaPuas.java',['../_madera_puas_8java.html',1,'']]], ['maderita_2ejava',['Maderita.java',['../_maderita_8java.html',1,'']]], ['maderota_2ejava',['Maderota.java',['../_maderota_8java.html',1,'']]] ];
JavaScript
var searchData= [ ['eliminaleglobo',['eliminaleGlobo',['../class_patricio.html#a9e112dd1e63dd0316a97e1b9ec56aa6b',1,'Patricio']]], ['encuentralindonopal',['encuentraLindoNopal',['../class_globito.html#aed55cd95e3cf68c1d77b85a158243a5f',1,'Globito']]], ['encuentramaderita',['encuentraMaderita',['../class_globito.html#ae9f1420533cae06335311af15b53ce5b',1,'Globito']]], ['espina',['Espina',['../class_espina.html',1,'']]], ['espina_2ejava',['Espina.java',['../_espina_8java.html',1,'']]], ['espinasvamostodosjuntos',['espinasVamosTodosJuntos',['../class_cactusder.html#af88406db8e80577654b3e3229d74628b',1,'Cactusder.espinasVamosTodosJuntos()'],['../class_cactusizq.html#a7e840ee1f1c78c08a100a3efced2d869',1,'Cactusizq.espinasVamosTodosJuntos()'],['../class_disparo.html#a6f949a9d961657af51875b0cca5e09da',1,'Disparo.espinasVamosTodosJuntos()']]], ['espinitamepego',['espinitaMePego',['../class_piedrita.html#a2e12f9694203bd1e0aeb148b7664366a',1,'Piedrita']]] ];
JavaScript
var class_maderota = [ [ "act", "class_maderota.html#aa749324d5e580c35b7b1e7e7c35e1c61", null ], [ "maderaCae", "class_maderota.html#a7e87571ca7fbd98acaa8bb262d1820e0", null ], [ "meEncontreUnaCaja", "class_maderota.html#a48e7fa54c93dc02c1e1518ce734bc646", null ], [ "piedritaMeCayoEncima", "class_maderota.html#a460688b513165fd88c7a880aa285d33c", null ], [ "rotaMadera", "class_maderota.html#a96b99a015ea033561ff1d7dd91b7c7f9", null ], [ "rotaMaderaInclinada", "class_maderota.html#a6777dfe4794195c6d0e1f51a74c29004", null ], [ "rotaMueveObstaculos", "class_maderota.html#a9f8d79b99b2abee616f15790612e8de7", null ], [ "rotaMueveObstaculosInclinados", "class_maderota.html#a954d72f2eec05f526f3490f189959bc7", null ], [ "yaNoEstaCaja", "class_maderota.html#ad579114bf6596692f2d78864a3643551", null ] ];
JavaScript
var class_madera_puas = [ [ "act", "class_madera_puas.html#a844bba5a87f3ae057b6a0cfdfdd632ac", null ] ];
JavaScript
function toggleVisibility(linkObj) { var base = $(linkObj).attr('id'); var summary = $('#'+base+'-summary'); var content = $('#'+base+'-content'); var trigger = $('#'+base+'-trigger'); var src=$(trigger).attr('src'); if (content.is(':visible')===true) { content.hide(); summary.show(); $(linkObj).addClass('closed').removeClass('opened'); $(trigger).attr('src',src.substring(0,src.length-8)+'closed.png'); } else { content.show(); summary.hide(); $(linkObj).removeClass('closed').addClass('opened'); $(trigger).attr('src',src.substring(0,src.length-10)+'open.png'); } return false; } function updateStripes() { $('table.directory tr'). removeClass('even').filter(':visible:even').addClass('even'); } function toggleLevel(level) { $('table.directory tr').each(function(){ var l = this.id.split('_').length-1; var i = $('#img'+this.id.substring(3)); var a = $('#arr'+this.id.substring(3)); if (l<level+1) { i.attr('src','ftv2folderopen.png'); a.attr('src','ftv2mnode.png'); $(this).show(); } else if (l==level+1) { i.attr('src','ftv2folderclosed.png'); a.attr('src','ftv2pnode.png'); $(this).show(); } else { $(this).hide(); } }); updateStripes(); } function toggleFolder(id) { //The clicked row var currentRow = $('#row_'+id); var currentRowImages = currentRow.find("img"); //All rows after the clicked row var rows = currentRow.nextAll("tr"); //Only match elements AFTER this one (can't hide elements before) var childRows = rows.filter(function() { var re = new RegExp('^row_'+id+'\\d+_$', "i"); //only one sub return this.id.match(re); }); //First row is visible we are HIDING if (childRows.filter(':first').is(':visible')===true) { currentRowImages.filter("[id^=arr]").attr('src', 'ftv2pnode.png'); currentRowImages.filter("[id^=img]").attr('src', 'ftv2folderclosed.png'); rows.filter("[id^=row_"+id+"]").hide(); } else { //We are SHOWING //All sub images var childImages = childRows.find("img"); var childImg = childImages.filter("[id^=img]"); var childArr = childImages.filter("[id^=arr]"); currentRow.find("[id^=arr]").attr('src', 'ftv2mnode.png'); //open row currentRow.find("[id^=img]").attr('src', 'ftv2folderopen.png'); //open row childImg.attr('src','ftv2folderclosed.png'); //children closed childArr.attr('src','ftv2pnode.png'); //children closed childRows.show(); //show all children } updateStripes(); } function toggleInherit(id) { var rows = $('tr.inherit.'+id); var img = $('tr.inherit_header.'+id+' img'); var src = $(img).attr('src'); if (rows.filter(':first').is(':visible')===true) { rows.css('display','none'); $(img).attr('src',src.substring(0,src.length-8)+'closed.png'); } else { rows.css('display','table-row'); // using show() causes jump in firefox $(img).attr('src',src.substring(0,src.length-10)+'open.png'); } }
JavaScript
var class_simple_timer = [ [ "mark", "class_simple_timer.html#abe5debfac2280fc4f432a496393ddfe8", null ], [ "millisElapsed", "class_simple_timer.html#abe6ae784edd29f6ab2e29da7b7ea0b1b", null ] ];
JavaScript
var files = [ [ "amigoBurbuja", "dir_9633a5761a6d31679e60c87082308daa.html", "dir_9633a5761a6d31679e60c87082308daa" ] ];
JavaScript
var class_help = [ [ "act", "class_help.html#af312c9b8bfa4b790457a0eddaffbac06", null ], [ "funciona", "class_help.html#ab9e6aceffe762be3cd5e08d274025aec", null ] ];
JavaScript
var class_next = [ [ "act", "class_next.html#a3c15a5aaf9c113b48141202d22a3e68b", null ], [ "funciona", "class_next.html#aaa63978613f1c10b27803296d1dcc10a", null ] ];
JavaScript
var annotated = [ [ "Back", "class_back.html", "class_back" ], [ "Button", "class_button.html", "class_button" ], [ "Cactus", "class_cactus.html", "class_cactus" ], [ "Cactusder", "class_cactusder.html", "class_cactusder" ], [ "Cactusizq", "class_cactusizq.html", "class_cactusizq" ], [ "Caja1", "class_caja1.html", "class_caja1" ], [ "Caja2", "class_caja2.html", "class_caja2" ], [ "Cajas", "class_cajas.html", "class_cajas" ], [ "Disparo", "class_disparo.html", "class_disparo" ], [ "Espina", "class_espina.html", "class_espina" ], [ "Fondo", "class_fondo.html", "class_fondo" ], [ "Globito", "class_globito.html", "class_globito" ], [ "Help", "class_help.html", "class_help" ], [ "Letrero", "class_letrero.html", "class_letrero" ], [ "MaderaPuas", "class_madera_puas.html", "class_madera_puas" ], [ "Maderita", "class_maderita.html", "class_maderita" ], [ "Maderota", "class_maderota.html", "class_maderota" ], [ "Next", "class_next.html", "class_next" ], [ "ObjetoSube", "class_objeto_sube.html", "class_objeto_sube" ], [ "Obstaculo", "class_obstaculo.html", "class_obstaculo" ], [ "Patricio", "class_patricio.html", "class_patricio" ], [ "Piedrita", "class_piedrita.html", "class_piedrita" ], [ "Play", "class_play.html", "class_play" ], [ "Portador", "class_portador.html", "class_portador" ], [ "Records", "class_records.html", "class_records" ], [ "RecordUser", "class_record_user.html", "class_record_user" ], [ "Score2", "class_score2.html", "class_score2" ], [ "SimpleTimer", "class_simple_timer.html", "class_simple_timer" ] ];
JavaScript
var NAVTREEINDEX0 = { "_back_8java.html":[1,0,0,0], "_button_8java.html":[1,0,0,1], "_cactus_8java.html":[1,0,0,2], "_cactusder_8java.html":[1,0,0,3], "_cactusizq_8java.html":[1,0,0,4], "_caja1_8java.html":[1,0,0,5], "_caja2_8java.html":[1,0,0,6], "_cajas_8java.html":[1,0,0,7], "_disparo_8java.html":[1,0,0,8], "_espina_8java.html":[1,0,0,9], "_fondo_8java.html":[1,0,0,10], "_globito_8java.html":[1,0,0,11], "_help_8java.html":[1,0,0,12], "_letrero_8java.html":[1,0,0,13], "_madera_puas_8java.html":[1,0,0,14], "_maderita_8java.html":[1,0,0,15], "_maderota_8java.html":[1,0,0,16], "_next_8java.html":[1,0,0,17], "_objeto_sube_8java.html":[1,0,0,18], "_obstaculo_8java.html":[1,0,0,19], "_patricio_8java.html":[1,0,0,20], "_piedrita_8java.html":[1,0,0,21], "_play_8java.html":[1,0,0,22], "_portador_8java.html":[1,0,0,23], "_record_user_8java.html":[1,0,0,25], "_records_8java.html":[1,0,0,24], "_score2_8java.html":[1,0,0,26], "_simple_timer_8java.html":[1,0,0,27], "annotated.html":[0,0], "class_back.html":[0,0,0], "class_back.html#a807accbd7bb2ec1d25ba5540e5b4782f":[0,0,0,0], "class_back.html#ae4050ebe451e4bbbc86de16a1ccf3af5":[0,0,0,1], "class_button.html":[0,0,1], "class_button.html#a7e0baf5af280f0fb468cd6b12da10a21":[0,0,1,1], "class_button.html#a9d017a57e3989ce2240a0649cf49622e":[0,0,1,0], "class_cactus.html":[0,0,2], "class_cactus.html#aa02e60007595bc48834855fa6dc23c49":[0,0,2,0], "class_cactusder.html":[0,0,3], "class_cactusder.html#ac02165576e3f663cd77506d26ddb8cb8":[0,0,3,0], "class_cactusder.html#af88406db8e80577654b3e3229d74628b":[0,0,3,1], "class_cactusizq.html":[0,0,4], "class_cactusizq.html#a7e840ee1f1c78c08a100a3efced2d869":[0,0,4,1], "class_cactusizq.html#ad3271c860cf6058261100d12262fa3cb":[0,0,4,0], "class_caja1.html":[0,0,5], "class_caja1.html#a11ba755bf50cccbcf448dd75e1157201":[0,0,5,0], "class_caja2.html":[0,0,6], "class_caja2.html#a22fb0940e176a09c5913edadfaf5a692":[0,0,6,0], "class_cajas.html":[0,0,7], "class_cajas.html#ac2b71915106a37ccb22ab6ee96b15f65":[0,0,7,0], "class_cajas.html#aca41fdb754ba69a3b57fec5cc53f110b":[0,0,7,1], "class_disparo.html":[0,0,8], "class_disparo.html#a49928fd68eee9b7cd7a51b19497237c9":[0,0,8,0], "class_disparo.html#a6f949a9d961657af51875b0cca5e09da":[0,0,8,2], "class_disparo.html#ab024e309ae6fb0c99177cf920ccdd418":[0,0,8,1], "class_espina.html":[0,0,9], "class_espina.html#a57eb765d3fb52d2c408f765fc9d6017f":[0,0,9,2], "class_espina.html#ad8a70b88b64446fe69f9f052b08399bb":[0,0,9,1], "class_espina.html#ae7c32cb63cb5b23222f7dd9bd936a3f8":[0,0,9,0], "class_fondo.html":[0,0,10], "class_fondo.html#a1107d3ba2cdfba378867034379cc4379":[0,0,10,2], "class_fondo.html#a1a9ef9436094fe86e9caa7022ce8b723":[0,0,10,9], "class_fondo.html#a3d44d436ac5c4d29b77021437ee76fb0":[0,0,10,5], "class_fondo.html#a6090581ed6699a2c087ddc44af07d366":[0,0,10,4], "class_fondo.html#a6cea3a5b0499050b257bd832718c5b88":[0,0,10,8], "class_fondo.html#a7912ecda505a9fb4faceae7367bc12bf":[0,0,10,7], "class_fondo.html#a8aee4e540c7671ab2162bce02094e0b2":[0,0,10,6], "class_fondo.html#a91241a6342021f1364c2f99cc510c564":[0,0,10,10], "class_fondo.html#ac40c7c0e021e132c08c90d72b29d9846":[0,0,10,3], "class_fondo.html#ae2286dba688ae7867fa228cec32f14f5":[0,0,10,0], "class_fondo.html#aed58d79190373dabad480ff928d61863":[0,0,10,1], "class_globito.html":[0,0,11], "class_globito.html#a28ba368a5af40d3a82f75ed56e8c859f":[0,0,11,1], "class_globito.html#a3123d3f7082be25ebc81b508b9013cf9":[0,0,11,0], "class_globito.html#a5477a2c09fbbeb77da5c7178d6cfc051":[0,0,11,6], "class_globito.html#a548c499f8850c11aa849e5fa147b952a":[0,0,11,8], "class_globito.html#a6dc4dee7fe0230442539a98e5c9dc640":[0,0,11,9], "class_globito.html#a8d7e41001ec04be905233ed89e08c5dd":[0,0,11,7], "class_globito.html#a96c6f69159240041c9ed43234b339990":[0,0,11,3], "class_globito.html#aba2590583e7128a5b2daa7feefb154be":[0,0,11,2], "class_globito.html#ae9f1420533cae06335311af15b53ce5b":[0,0,11,5], "class_globito.html#aed55cd95e3cf68c1d77b85a158243a5f":[0,0,11,4], "class_help.html":[0,0,12], "class_help.html#ab9e6aceffe762be3cd5e08d274025aec":[0,0,12,1], "class_help.html#af312c9b8bfa4b790457a0eddaffbac06":[0,0,12,0], "class_letrero.html":[0,0,13], "class_letrero.html#a6fb7d136cc91a443972e9071bb604ac5":[0,0,13,0], "class_letrero.html#ac3a506f2181a857a512dc4c59b1c4777":[0,0,13,1], "class_madera_puas.html":[0,0,14], "class_madera_puas.html#a844bba5a87f3ae057b6a0cfdfdd632ac":[0,0,14,0], "class_maderita.html":[0,0,15], "class_maderita.html#a6aee19b9595959a1ffe866a7ba7a43ca":[0,0,15,0], "class_maderota.html":[0,0,16], "class_maderota.html#a460688b513165fd88c7a880aa285d33c":[0,0,16,3], "class_maderota.html#a48e7fa54c93dc02c1e1518ce734bc646":[0,0,16,2], "class_maderota.html#a6777dfe4794195c6d0e1f51a74c29004":[0,0,16,5], "class_maderota.html#a7e87571ca7fbd98acaa8bb262d1820e0":[0,0,16,1], "class_maderota.html#a954d72f2eec05f526f3490f189959bc7":[0,0,16,7], "class_maderota.html#a96b99a015ea033561ff1d7dd91b7c7f9":[0,0,16,4], "class_maderota.html#a9f8d79b99b2abee616f15790612e8de7":[0,0,16,6], "class_maderota.html#aa749324d5e580c35b7b1e7e7c35e1c61":[0,0,16,0], "class_maderota.html#ad579114bf6596692f2d78864a3643551":[0,0,16,8], "class_next.html":[0,0,17], "class_next.html#a3c15a5aaf9c113b48141202d22a3e68b":[0,0,17,0], "class_next.html#aaa63978613f1c10b27803296d1dcc10a":[0,0,17,1], "class_objeto_sube.html":[0,0,18], "class_objeto_sube.html#a21b0c98372c740fe0237c6634cd6d581":[0,0,18,2], "class_objeto_sube.html#a4b5d4e87c960bf12629b81cef955a8fa":[0,0,18,1], "class_objeto_sube.html#a7de738f515da8d3a587cd5e499aa35d0":[0,0,18,0], "class_obstaculo.html":[0,0,19], "class_obstaculo.html#a20ffcfc83d21e3ee95578e105fab13de":[0,0,19,3], "class_obstaculo.html#a2e60e2ab931dd7e5a0e7f70d14639fc6":[0,0,19,5], "class_obstaculo.html#a694b3e6131e32db73eadf807f3dc9519":[0,0,19,4], "class_obstaculo.html#a8cb2aeaf3c3ce2920e973c1560ec7648":[0,0,19,2], "class_obstaculo.html#aa5aaa7230da50c4c7a094f0a2158e85e":[0,0,19,0], "class_obstaculo.html#ac432ad3bc5b8231458a5655ca46aac83":[0,0,19,1], "class_patricio.html":[0,0,20], "class_patricio.html#a1f4fd2f258d7382d1a83ea93980c1b1e":[0,0,20,2], "class_patricio.html#a428b9470ccc8f8e6d98d334afa86afa1":[0,0,20,3], "class_patricio.html#a5d59e42f276cc76374dea8bcdd62c9af":[0,0,20,0], "class_patricio.html#a6f27deb467412bc033067767d18b06fa":[0,0,20,5], "class_patricio.html#a9e112dd1e63dd0316a97e1b9ec56aa6b":[0,0,20,4], "class_patricio.html#aa82101df7af4858fb5f5f1b1bcac342d":[0,0,20,6], "class_patricio.html#ab970af130120f6224789db1a4801ce13":[0,0,20,8], "class_patricio.html#ad25fd9059632307ae3f3c66948ec184f":[0,0,20,7], "class_patricio.html#af6e9cd1691880ee6c7fdcf2e35f434d9":[0,0,20,1], "class_piedrita.html":[0,0,21], "class_piedrita.html#a0fa641a574af495e2b2a8f6890f4fd22":[0,0,21,2], "class_piedrita.html#a2e12f9694203bd1e0aeb148b7664366a":[0,0,21,1], "class_piedrita.html#a67271ff1e43b9afa13099d3ae7b9aacf":[0,0,21,0], "class_piedrita.html#adf72d40a56131fc132e4e105f9be7fb4":[0,0,21,3], "class_play.html":[0,0,22], "class_play.html#a4eabbc979faf6e9179282941f5d62184":[0,0,22,1], "class_play.html#a8bb5932cbd991a03a48b2822488bfd00":[0,0,22,0], "class_portador.html":[0,0,23], "class_portador.html#a91fca9c9d44b7313a09273c8062584c4":[0,0,23,1], "class_portador.html#ab1886fcb2ea38e1817475b3db1d76f06":[0,0,23,0], "class_portador.html#ac5937b88b5e49d58724521393c903671":[0,0,23,2], "class_record_user.html":[0,0,25], "class_record_user.html#a2917ce58fc6023747e46e3f692f3eeae":[0,0,25,1], "class_record_user.html#ab13f637d4d8e0408ddc347c9603bb8a3":[0,0,25,0], "class_records.html":[0,0,24], "class_records.html#ab25941bb7c2285becc24c7b9cad1ccce":[0,0,24,1], "class_records.html#afe173842b94eacf97c9ee76a50894c73":[0,0,24,0], "class_score2.html":[0,0,26], "class_score2.html#a083ba99764f5fd2508e9fcc1bc144853":[0,0,26,1], "class_score2.html#a08a210b8c46bde0a2c344e886d9cd67e":[0,0,26,5], "class_score2.html#a561cc012e4db409856ada84ca032ea96":[0,0,26,3], "class_score2.html#aad1d2accb6f42a7bbb0de01c0c13078b":[0,0,26,4], "class_score2.html#abfc2a3f86bbadbb5103cc0c67bb2abcf":[0,0,26,0], "class_score2.html#aefbbeb7093f17f0d2eecbf3a5a0412a8":[0,0,26,2], "class_simple_timer.html":[0,0,27], "class_simple_timer.html#abe5debfac2280fc4f432a496393ddfe8":[0,0,27,0], "class_simple_timer.html#abe6ae784edd29f6ab2e29da7b7ea0b1b":[0,0,27,1], "classes.html":[0,1], "dir_9633a5761a6d31679e60c87082308daa.html":[1,0,0], "files.html":[1,0], "functions.html":[0,3,0], "functions_func.html":[0,3,1], "hierarchy.html":[0,2], "index.html":[], "pages.html":[] };
JavaScript
var class_maderita = [ [ "act", "class_maderita.html#a6aee19b9595959a1ffe866a7ba7a43ca", null ] ];
JavaScript
var class_cajas = [ [ "act", "class_cajas.html#ac2b71915106a37ccb22ab6ee96b15f65", null ], [ "meTocoUnRaton", "class_cajas.html#aca41fdb754ba69a3b57fec5cc53f110b", null ] ];
JavaScript
var class_back = [ [ "act", "class_back.html#a807accbd7bb2ec1d25ba5540e5b4782f", null ], [ "funciona", "class_back.html#ae4050ebe451e4bbbc86de16a1ccf3af5", null ] ];
JavaScript
var cookie_namespace = 'doxygen'; var sidenav,navtree,content,header; function readCookie(cookie) { var myCookie = cookie_namespace+"_"+cookie+"="; if (document.cookie) { var index = document.cookie.indexOf(myCookie); if (index != -1) { var valStart = index + myCookie.length; var valEnd = document.cookie.indexOf(";", valStart); if (valEnd == -1) { valEnd = document.cookie.length; } var val = document.cookie.substring(valStart, valEnd); return val; } } return 0; } function writeCookie(cookie, val, expiration) { if (val==undefined) return; if (expiration == null) { var date = new Date(); date.setTime(date.getTime()+(10*365*24*60*60*1000)); // default expiration is one week expiration = date.toGMTString(); } document.cookie = cookie_namespace + "_" + cookie + "=" + val + "; expires=" + expiration+"; path=/"; } function resizeWidth() { var windowWidth = $(window).width() + "px"; var sidenavWidth = $(sidenav).outerWidth(); content.css({marginLeft:parseInt(sidenavWidth)+6+"px"}); //account for 6px-wide handle-bar writeCookie('width',sidenavWidth, null); } function restoreWidth(navWidth) { var windowWidth = $(window).width() + "px"; content.css({marginLeft:parseInt(navWidth)+6+"px"}); sidenav.css({width:navWidth + "px"}); } function resizeHeight() { var headerHeight = header.outerHeight(); var footerHeight = footer.outerHeight(); var windowHeight = $(window).height() - headerHeight - footerHeight; content.css({height:windowHeight + "px"}); navtree.css({height:windowHeight + "px"}); sidenav.css({height:windowHeight + "px",top: headerHeight+"px"}); } function initResizable() { header = $("#top"); sidenav = $("#side-nav"); content = $("#doc-content"); navtree = $("#nav-tree"); footer = $("#nav-path"); $(".side-nav-resizable").resizable({resize: function(e, ui) { resizeWidth(); } }); $(window).resize(function() { resizeHeight(); }); var width = readCookie('width'); if (width) { restoreWidth(width); } else { resizeWidth(); } resizeHeight(); var url = location.href; var i=url.indexOf("#"); if (i>=0) window.location.hash=url.substr(i); var _preventDefault = function(evt) { evt.preventDefault(); }; $("#splitbar").bind("dragstart", _preventDefault).bind("selectstart", _preventDefault); $(document).bind('touchmove',function(e){ try { var target = e.target; while (target) { if ($(target).css('-webkit-overflow-scrolling')=='touch') return; target = target.parentNode; } e.preventDefault(); } catch(err) { e.preventDefault(); } }); }
JavaScript
var class_fondo = [ [ "Fondo", "class_fondo.html#ae2286dba688ae7867fa228cec32f14f5", null ], [ "actualicemosPuntos", "class_fondo.html#aed58d79190373dabad480ff928d61863", null ], [ "cambiaJuego", "class_fondo.html#a1107d3ba2cdfba378867034379cc4379", null ], [ "GameRecords", "class_fondo.html#ac40c7c0e021e132c08c90d72b29d9846", null ], [ "getLives", "class_fondo.html#a6090581ed6699a2c087ddc44af07d366", null ], [ "getScore", "class_fondo.html#a3d44d436ac5c4d29b77021437ee76fb0", null ], [ "ponNivel", "class_fondo.html#a8aee4e540c7671ab2162bce02094e0b2", null ], [ "prepare1", "class_fondo.html#a7912ecda505a9fb4faceae7367bc12bf", null ], [ "regresaMenu", "class_fondo.html#a6cea3a5b0499050b257bd832718c5b88", null ], [ "reiniciaNivel", "class_fondo.html#a1a9ef9436094fe86e9caa7022ce8b723", null ], [ "remove", "class_fondo.html#a91241a6342021f1364c2f99cc510c564", null ] ];
JavaScript
var class_piedrita = [ [ "act", "class_piedrita.html#a67271ff1e43b9afa13099d3ae7b9aacf", null ], [ "espinitaMePego", "class_piedrita.html#a2e12f9694203bd1e0aeb148b7664366a", null ], [ "siPiedritaEncuentraCaja", "class_piedrita.html#a0fa641a574af495e2b2a8f6890f4fd22", null ], [ "siPiedritaEncuentraMaderita", "class_piedrita.html#adf72d40a56131fc132e4e105f9be7fb4", null ] ];
JavaScript
var class_score2 = [ [ "Score2", "class_score2.html#abfc2a3f86bbadbb5103cc0c67bb2abcf", null ], [ "act", "class_score2.html#a083ba99764f5fd2508e9fcc1bc144853", null ], [ "damePuntaje", "class_score2.html#aefbbeb7093f17f0d2eecbf3a5a0412a8", null ], [ "decrementaPuntaje", "class_score2.html#a561cc012e4db409856ada84ca032ea96", null ], [ "muestraPuntaje", "class_score2.html#aad1d2accb6f42a7bbb0de01c0c13078b", null ], [ "puntajeLlegoCero", "class_score2.html#a08a210b8c46bde0a2c344e886d9cd67e", null ] ];
JavaScript
var NAVTREE = [ [ "Amigo Burbuja", "index.html", [ [ "Classes", null, [ [ "Class List", "annotated.html", "annotated" ], [ "Class Index", "classes.html", null ], [ "Class Hierarchy", "hierarchy.html", "hierarchy" ], [ "Class Members", "functions.html", [ [ "All", "functions.html", null ], [ "Functions", "functions_func.html", null ] ] ] ] ], [ "Files", null, [ [ "File List", "files.html", "files" ] ] ] ] ] ]; var NAVTREEINDEX = [ "_back_8java.html" ]; var SYNCONMSG = 'click to disable panel synchronisation'; var SYNCOFFMSG = 'click to enable panel synchronisation'; var navTreeSubIndices = new Array(); function getData(varName) { var i = varName.lastIndexOf('/'); var n = i>=0 ? varName.substring(i+1) : varName; return eval(n.replace(/\-/g,'_')); } function stripPath(uri) { return uri.substring(uri.lastIndexOf('/')+1); } function stripPath2(uri) { var i = uri.lastIndexOf('/'); var s = uri.substring(i+1); var m = uri.substring(0,i+1).match(/\/d\w\/d\w\w\/$/); return m ? uri.substring(i-6) : s; } function localStorageSupported() { try { return 'localStorage' in window && window['localStorage'] !== null && window.localStorage.getItem; } catch(e) { return false; } } function storeLink(link) { if (!$("#nav-sync").hasClass('sync') && localStorageSupported()) { window.localStorage.setItem('navpath',link); } } function deleteLink() { if (localStorageSupported()) { window.localStorage.setItem('navpath',''); } } function cachedLink() { if (localStorageSupported()) { return window.localStorage.getItem('navpath'); } else { return ''; } } function getScript(scriptName,func,show) { var head = document.getElementsByTagName("head")[0]; var script = document.createElement('script'); script.id = scriptName; script.type = 'text/javascript'; script.onload = func; script.src = scriptName+'.js'; if ($.browser.msie && $.browser.version<=8) { // script.onload does not work with older versions of IE script.onreadystatechange = function() { if (script.readyState=='complete' || script.readyState=='loaded') { func(); if (show) showRoot(); } } } head.appendChild(script); } function createIndent(o,domNode,node,level) { var level=-1; var n = node; while (n.parentNode) { level++; n=n.parentNode; } var imgNode = document.createElement("img"); imgNode.style.paddingLeft=(16*level).toString()+'px'; imgNode.width = 16; imgNode.height = 22; imgNode.border = 0; if (node.childrenData) { node.plus_img = imgNode; node.expandToggle = document.createElement("a"); node.expandToggle.href = "javascript:void(0)"; node.expandToggle.onclick = function() { if (node.expanded) { $(node.getChildrenUL()).slideUp("fast"); node.plus_img.src = node.relpath+"ftv2pnode.png"; node.expanded = false; } else { expandNode(o, node, false, false); } } node.expandToggle.appendChild(imgNode); domNode.appendChild(node.expandToggle); imgNode.src = node.relpath+"ftv2pnode.png"; } else { imgNode.src = node.relpath+"ftv2node.png"; domNode.appendChild(imgNode); } } var animationInProgress = false; function gotoAnchor(anchor,aname,updateLocation) { var pos, docContent = $('#doc-content'); if (anchor.parent().attr('class')=='memItemLeft' || anchor.parent().attr('class')=='fieldtype' || anchor.parent().is(':header')) { pos = anchor.parent().position().top; } else if (anchor.position()) { pos = anchor.position().top; } if (pos) { var dist = Math.abs(Math.min( pos-docContent.offset().top, docContent[0].scrollHeight- docContent.height()-docContent.scrollTop())); animationInProgress=true; docContent.animate({ scrollTop: pos + docContent.scrollTop() - docContent.offset().top },Math.max(50,Math.min(500,dist)),function(){ if (updateLocation) window.location.href=aname; animationInProgress=false; }); } } function newNode(o, po, text, link, childrenData, lastNode) { var node = new Object(); node.children = Array(); node.childrenData = childrenData; node.depth = po.depth + 1; node.relpath = po.relpath; node.isLast = lastNode; node.li = document.createElement("li"); po.getChildrenUL().appendChild(node.li); node.parentNode = po; node.itemDiv = document.createElement("div"); node.itemDiv.className = "item"; node.labelSpan = document.createElement("span"); node.labelSpan.className = "label"; createIndent(o,node.itemDiv,node,0); node.itemDiv.appendChild(node.labelSpan); node.li.appendChild(node.itemDiv); var a = document.createElement("a"); node.labelSpan.appendChild(a); node.label = document.createTextNode(text); node.expanded = false; a.appendChild(node.label); if (link) { var url; if (link.substring(0,1)=='^') { url = link.substring(1); link = url; } else { url = node.relpath+link; } a.className = stripPath(link.replace('#',':')); if (link.indexOf('#')!=-1) { var aname = '#'+link.split('#')[1]; var srcPage = stripPath($(location).attr('pathname')); var targetPage = stripPath(link.split('#')[0]); a.href = srcPage!=targetPage ? url : "javascript:void(0)"; a.onclick = function(){ storeLink(link); if (!$(a).parent().parent().hasClass('selected')) { $('.item').removeClass('selected'); $('.item').removeAttr('id'); $(a).parent().parent().addClass('selected'); $(a).parent().parent().attr('id','selected'); } var anchor = $(aname); gotoAnchor(anchor,aname,true); }; } else { a.href = url; a.onclick = function() { storeLink(link); } } } else { if (childrenData != null) { a.className = "nolink"; a.href = "javascript:void(0)"; a.onclick = node.expandToggle.onclick; } } node.childrenUL = null; node.getChildrenUL = function() { if (!node.childrenUL) { node.childrenUL = document.createElement("ul"); node.childrenUL.className = "children_ul"; node.childrenUL.style.display = "none"; node.li.appendChild(node.childrenUL); } return node.childrenUL; }; return node; } function showRoot() { var headerHeight = $("#top").height(); var footerHeight = $("#nav-path").height(); var windowHeight = $(window).height() - headerHeight - footerHeight; (function (){ // retry until we can scroll to the selected item try { var navtree=$('#nav-tree'); navtree.scrollTo('#selected',0,{offset:-windowHeight/2}); } catch (err) { setTimeout(arguments.callee, 0); } })(); } function expandNode(o, node, imm, showRoot) { if (node.childrenData && !node.expanded) { if (typeof(node.childrenData)==='string') { var varName = node.childrenData; getScript(node.relpath+varName,function(){ node.childrenData = getData(varName); expandNode(o, node, imm, showRoot); }, showRoot); } else { if (!node.childrenVisited) { getNode(o, node); } if (imm || ($.browser.msie && $.browser.version>8)) { // somehow slideDown jumps to the start of tree for IE9 :-( $(node.getChildrenUL()).show(); } else { $(node.getChildrenUL()).slideDown("fast"); } if (node.isLast) { node.plus_img.src = node.relpath+"ftv2mlastnode.png"; } else { node.plus_img.src = node.relpath+"ftv2mnode.png"; } node.expanded = true; } } } function glowEffect(n,duration) { n.addClass('glow').delay(duration).queue(function(next){ $(this).removeClass('glow');next(); }); } function highlightAnchor() { var aname = $(location).attr('hash'); var anchor = $(aname); if (anchor.parent().attr('class')=='memItemLeft'){ var rows = $('.memberdecls tr[class$="'+ window.location.hash.substring(1)+'"]'); glowEffect(rows.children(),300); // member without details } else if (anchor.parents().slice(2).prop('tagName')=='TR') { glowEffect(anchor.parents('div.memitem'),1000); // enum value } else if (anchor.parent().attr('class')=='fieldtype'){ glowEffect(anchor.parent().parent(),1000); // struct field } else if (anchor.parent().is(":header")) { glowEffect(anchor.parent(),1000); // section header } else { glowEffect(anchor.next(),1000); // normal member } gotoAnchor(anchor,aname,false); } function selectAndHighlight(hash,n) { var a; if (hash) { var link=stripPath($(location).attr('pathname'))+':'+hash.substring(1); a=$('.item a[class$="'+link+'"]'); } if (a && a.length) { a.parent().parent().addClass('selected'); a.parent().parent().attr('id','selected'); highlightAnchor(); } else if (n) { $(n.itemDiv).addClass('selected'); $(n.itemDiv).attr('id','selected'); } if ($('#nav-tree-contents .item:first').hasClass('selected')) { $('#nav-sync').css('top','30px'); } else { $('#nav-sync').css('top','5px'); } showRoot(); } function showNode(o, node, index, hash) { if (node && node.childrenData) { if (typeof(node.childrenData)==='string') { var varName = node.childrenData; getScript(node.relpath+varName,function(){ node.childrenData = getData(varName); showNode(o,node,index,hash); },true); } else { if (!node.childrenVisited) { getNode(o, node); } $(node.getChildrenUL()).show(); if (node.isLast) { node.plus_img.src = node.relpath+"ftv2mlastnode.png"; } else { node.plus_img.src = node.relpath+"ftv2mnode.png"; } node.expanded = true; var n = node.children[o.breadcrumbs[index]]; if (index+1<o.breadcrumbs.length) { showNode(o,n,index+1,hash); } else { if (typeof(n.childrenData)==='string') { var varName = n.childrenData; getScript(n.relpath+varName,function(){ n.childrenData = getData(varName); node.expanded=false; showNode(o,node,index,hash); // retry with child node expanded },true); } else { var rootBase = stripPath(o.toroot.replace(/\..+$/, '')); if (rootBase=="index" || rootBase=="pages" || rootBase=="search") { expandNode(o, n, true, true); } selectAndHighlight(hash,n); } } } } else { selectAndHighlight(hash); } } function getNode(o, po) { po.childrenVisited = true; var l = po.childrenData.length-1; for (var i in po.childrenData) { var nodeData = po.childrenData[i]; po.children[i] = newNode(o, po, nodeData[0], nodeData[1], nodeData[2], i==l); } } function gotoNode(o,subIndex,root,hash,relpath) { var nti = navTreeSubIndices[subIndex][root+hash]; o.breadcrumbs = $.extend(true, [], nti ? nti : navTreeSubIndices[subIndex][root]); if (!o.breadcrumbs && root!=NAVTREE[0][1]) { // fallback: show index navTo(o,NAVTREE[0][1],"",relpath); $('.item').removeClass('selected'); $('.item').removeAttr('id'); } if (o.breadcrumbs) { o.breadcrumbs.unshift(0); // add 0 for root node showNode(o, o.node, 0, hash); } } function navTo(o,root,hash,relpath) { var link = cachedLink(); if (link) { var parts = link.split('#'); root = parts[0]; if (parts.length>1) hash = '#'+parts[1]; else hash=''; } if (hash.match(/^#l\d+$/)) { var anchor=$('a[name='+hash.substring(1)+']'); glowEffect(anchor.parent(),1000); // line number hash=''; // strip line number anchors //root=root.replace(/_source\./,'.'); // source link to doc link } var url=root+hash; var i=-1; while (NAVTREEINDEX[i+1]<=url) i++; if (i==-1) { i=0; root=NAVTREE[0][1]; } // fallback: show index if (navTreeSubIndices[i]) { gotoNode(o,i,root,hash,relpath) } else { getScript(relpath+'navtreeindex'+i,function(){ navTreeSubIndices[i] = eval('NAVTREEINDEX'+i); if (navTreeSubIndices[i]) { gotoNode(o,i,root,hash,relpath); } },true); } } function showSyncOff(n,relpath) { n.html('<img src="'+relpath+'sync_off.png" title="'+SYNCOFFMSG+'"/>'); } function showSyncOn(n,relpath) { n.html('<img src="'+relpath+'sync_on.png" title="'+SYNCONMSG+'"/>'); } function toggleSyncButton(relpath) { var navSync = $('#nav-sync'); if (navSync.hasClass('sync')) { navSync.removeClass('sync'); showSyncOff(navSync,relpath); storeLink(stripPath2($(location).attr('pathname'))+$(location).attr('hash')); } else { navSync.addClass('sync'); showSyncOn(navSync,relpath); deleteLink(); } } function initNavTree(toroot,relpath) { var o = new Object(); o.toroot = toroot; o.node = new Object(); o.node.li = document.getElementById("nav-tree-contents"); o.node.childrenData = NAVTREE; o.node.children = new Array(); o.node.childrenUL = document.createElement("ul"); o.node.getChildrenUL = function() { return o.node.childrenUL; }; o.node.li.appendChild(o.node.childrenUL); o.node.depth = 0; o.node.relpath = relpath; o.node.expanded = false; o.node.isLast = true; o.node.plus_img = document.createElement("img"); o.node.plus_img.src = relpath+"ftv2pnode.png"; o.node.plus_img.width = 16; o.node.plus_img.height = 22; if (localStorageSupported()) { var navSync = $('#nav-sync'); if (cachedLink()) { showSyncOff(navSync,relpath); navSync.removeClass('sync'); } else { showSyncOn(navSync,relpath); } navSync.click(function(){ toggleSyncButton(relpath); }); } navTo(o,toroot,window.location.hash,relpath); $(window).bind('hashchange', function(){ if (window.location.hash && window.location.hash.length>1){ var a; if ($(location).attr('hash')){ var clslink=stripPath($(location).attr('pathname'))+':'+ $(location).attr('hash').substring(1); a=$('.item a[class$="'+clslink+'"]'); } if (a==null || !$(a).parent().parent().hasClass('selected')){ $('.item').removeClass('selected'); $('.item').removeAttr('id'); } var link=stripPath2($(location).attr('pathname')); navTo(o,link,$(location).attr('hash'),relpath); } else if (!animationInProgress) { $('#doc-content').scrollTop(0); $('.item').removeClass('selected'); $('.item').removeAttr('id'); navTo(o,toroot,window.location.hash,relpath); } }) $(window).load(showRoot); }
JavaScript
var class_caja1 = [ [ "act", "class_caja1.html#a11ba755bf50cccbcf448dd75e1157201", null ] ];
JavaScript
var class_espina = [ [ "act", "class_espina.html#ae7c32cb63cb5b23222f7dd9bd936a3f8", null ], [ "disparaDer", "class_espina.html#ad8a70b88b64446fe69f9f052b08399bb", null ], [ "disparaIzq", "class_espina.html#a57eb765d3fb52d2c408f765fc9d6017f", null ] ];
JavaScript
var class_obstaculo = [ [ "Obstaculo", "class_obstaculo.html#aa5aaa7230da50c4c7a094f0a2158e85e", null ], [ "act", "class_obstaculo.html#ac432ad3bc5b8231458a5655ca46aac83", null ], [ "baja", "class_obstaculo.html#a8cb2aeaf3c3ce2920e973c1560ec7648", null ], [ "caeObjeto", "class_obstaculo.html#a20ffcfc83d21e3ee95578e105fab13de", null ], [ "mueveX", "class_obstaculo.html#a694b3e6131e32db73eadf807f3dc9519", null ], [ "seEncuetraObstaculo", "class_obstaculo.html#a2e60e2ab931dd7e5a0e7f70d14639fc6", null ] ];
JavaScript
var class_patricio = [ [ "Patricio", "class_patricio.html#a5d59e42f276cc76374dea8bcdd62c9af", null ], [ "act", "class_patricio.html#af6e9cd1691880ee6c7fdcf2e35f434d9", null ], [ "caePatricio", "class_patricio.html#a1f4fd2f258d7382d1a83ea93980c1b1e", null ], [ "detenPatricio", "class_patricio.html#a428b9470ccc8f8e6d98d334afa86afa1", null ], [ "eliminaleGlobo", "class_patricio.html#a9e112dd1e63dd0316a97e1b9ec56aa6b", null ], [ "mueve", "class_patricio.html#a6f27deb467412bc033067767d18b06fa", null ], [ "noSeEncuetraGlobo", "class_patricio.html#aa82101df7af4858fb5f5f1b1bcac342d", null ], [ "recibeGlobo", "class_patricio.html#ad25fd9059632307ae3f3c66948ec184f", null ], [ "sigueSubiendoPat", "class_patricio.html#ab970af130120f6224789db1a4801ce13", null ] ];
JavaScript
var class_portador = [ [ "act", "class_portador.html#ab1886fcb2ea38e1817475b3db1d76f06", null ], [ "meTocoUnRaton", "class_portador.html#a91fca9c9d44b7313a09273c8062584c4", null ], [ "seEncuetraObstaculo", "class_portador.html#ac5937b88b5e49d58724521393c903671", null ] ];
JavaScript
var class_cactusizq = [ [ "act", "class_cactusizq.html#ad3271c860cf6058261100d12262fa3cb", null ], [ "espinasVamosTodosJuntos", "class_cactusizq.html#a7e840ee1f1c78c08a100a3efced2d869", null ] ];
JavaScript
var class_button = [ [ "act", "class_button.html#a9d017a57e3989ce2240a0649cf49622e", null ], [ "funciona", "class_button.html#a7e0baf5af280f0fb468cd6b12da10a21", null ] ];
JavaScript
var class_objeto_sube = [ [ "mueve", "class_objeto_sube.html#a7de738f515da8d3a587cd5e499aa35d0", null ], [ "subir", "class_objeto_sube.html#a4b5d4e87c960bf12629b81cef955a8fa", null ], [ "subir", "class_objeto_sube.html#a21b0c98372c740fe0237c6634cd6d581", null ] ];
JavaScript
var class_globito = [ [ "Globito", "class_globito.html#a3123d3f7082be25ebc81b508b9013cf9", null ], [ "act", "class_globito.html#a28ba368a5af40d3a82f75ed56e8c859f", null ], [ "cambiaImagenGlobo", "class_globito.html#aba2590583e7128a5b2daa7feefb154be", null ], [ "contador", "class_globito.html#a96c6f69159240041c9ed43234b339990", null ], [ "encuentraLindoNopal", "class_globito.html#aed55cd95e3cf68c1d77b85a158243a5f", null ], [ "encuentraMaderita", "class_globito.html#ae9f1420533cae06335311af15b53ce5b", null ], [ "meEncontreUnGloboLoPoncho", "class_globito.html#a5477a2c09fbbeb77da5c7178d6cfc051", null ], [ "mueve", "class_globito.html#a8d7e41001ec04be905233ed89e08c5dd", null ], [ "reiniciaPosicion", "class_globito.html#a548c499f8850c11aa849e5fa147b952a", null ], [ "seEncuentraGlobo", "class_globito.html#a6dc4dee7fe0230442539a98e5c9dc640", null ] ];
JavaScript
var hierarchy = [ [ "Actor", null, [ [ "Button", "class_button.html", [ [ "Back", "class_back.html", null ], [ "Help", "class_help.html", null ], [ "Next", "class_next.html", null ], [ "Play", "class_play.html", null ], [ "Records", "class_records.html", null ] ] ], [ "Cajas", "class_cajas.html", [ [ "Caja1", "class_caja1.html", null ], [ "Caja2", "class_caja2.html", null ] ] ], [ "Disparo", "class_disparo.html", [ [ "Cactusder", "class_cactusder.html", null ], [ "Cactusizq", "class_cactusizq.html", null ] ] ], [ "Espina", "class_espina.html", null ], [ "Letrero", "class_letrero.html", null ], [ "ObjetoSube", "class_objeto_sube.html", [ [ "Globito", "class_globito.html", null ], [ "Patricio", "class_patricio.html", null ] ] ], [ "Obstaculo", "class_obstaculo.html", [ [ "Cactus", "class_cactus.html", null ], [ "Piedrita", "class_piedrita.html", null ] ] ], [ "Portador", "class_portador.html", [ [ "Maderita", "class_maderita.html", null ], [ "Maderota", "class_maderota.html", [ [ "MaderaPuas", "class_madera_puas.html", null ] ] ] ] ], [ "Score2", "class_score2.html", null ] ] ], [ "RecordUser", "class_record_user.html", null ], [ "SimpleTimer", "class_simple_timer.html", null ], [ "World", null, [ [ "Fondo", "class_fondo.html", null ] ] ] ];
JavaScript
var class_caja2 = [ [ "act", "class_caja2.html#a22fb0940e176a09c5913edadfaf5a692", null ] ];
JavaScript
var class_disparo = [ [ "accedeEspinita", "class_disparo.html#a49928fd68eee9b7cd7a51b19497237c9", null ], [ "act", "class_disparo.html#ab024e309ae6fb0c99177cf920ccdd418", null ], [ "espinasVamosTodosJuntos", "class_disparo.html#a6f949a9d961657af51875b0cca5e09da", null ] ];
JavaScript
var class_record_user = [ [ "RecordUser", "class_record_user.html#ab13f637d4d8e0408ddc347c9603bb8a3", null ], [ "addToWorld", "class_record_user.html#a2917ce58fc6023747e46e3f692f3eeae", null ] ];
JavaScript
var class_cactus = [ [ "act", "class_cactus.html#aa02e60007595bc48834855fa6dc23c49", null ] ];
JavaScript
var class_cactusder = [ [ "act", "class_cactusder.html#ac02165576e3f663cd77506d26ddb8cb8", null ], [ "espinasVamosTodosJuntos", "class_cactusder.html#af88406db8e80577654b3e3229d74628b", null ] ];
JavaScript
var class_letrero = [ [ "Letrero", "class_letrero.html#a6fb7d136cc91a443972e9071bb604ac5", null ], [ "muestraLetrero", "class_letrero.html#ac3a506f2181a857a512dc4c59b1c4777", null ] ];
JavaScript
var dir_9633a5761a6d31679e60c87082308daa = [ [ "Back.java", "_back_8java.html", [ [ "Back", "class_back.html", "class_back" ] ] ], [ "Button.java", "_button_8java.html", [ [ "Button", "class_button.html", "class_button" ] ] ], [ "Cactus.java", "_cactus_8java.html", [ [ "Cactus", "class_cactus.html", "class_cactus" ] ] ], [ "Cactusder.java", "_cactusder_8java.html", [ [ "Cactusder", "class_cactusder.html", "class_cactusder" ] ] ], [ "Cactusizq.java", "_cactusizq_8java.html", [ [ "Cactusizq", "class_cactusizq.html", "class_cactusizq" ] ] ], [ "Caja1.java", "_caja1_8java.html", [ [ "Caja1", "class_caja1.html", "class_caja1" ] ] ], [ "Caja2.java", "_caja2_8java.html", [ [ "Caja2", "class_caja2.html", "class_caja2" ] ] ], [ "Cajas.java", "_cajas_8java.html", [ [ "Cajas", "class_cajas.html", "class_cajas" ] ] ], [ "Disparo.java", "_disparo_8java.html", [ [ "Disparo", "class_disparo.html", "class_disparo" ] ] ], [ "Espina.java", "_espina_8java.html", [ [ "Espina", "class_espina.html", "class_espina" ] ] ], [ "Fondo.java", "_fondo_8java.html", [ [ "Fondo", "class_fondo.html", "class_fondo" ] ] ], [ "Globito.java", "_globito_8java.html", [ [ "Globito", "class_globito.html", "class_globito" ] ] ], [ "Help.java", "_help_8java.html", [ [ "Help", "class_help.html", "class_help" ] ] ], [ "Letrero.java", "_letrero_8java.html", [ [ "Letrero", "class_letrero.html", "class_letrero" ] ] ], [ "MaderaPuas.java", "_madera_puas_8java.html", [ [ "MaderaPuas", "class_madera_puas.html", "class_madera_puas" ] ] ], [ "Maderita.java", "_maderita_8java.html", [ [ "Maderita", "class_maderita.html", "class_maderita" ] ] ], [ "Maderota.java", "_maderota_8java.html", [ [ "Maderota", "class_maderota.html", "class_maderota" ] ] ], [ "Next.java", "_next_8java.html", [ [ "Next", "class_next.html", "class_next" ] ] ], [ "ObjetoSube.java", "_objeto_sube_8java.html", [ [ "ObjetoSube", "class_objeto_sube.html", "class_objeto_sube" ] ] ], [ "Obstaculo.java", "_obstaculo_8java.html", [ [ "Obstaculo", "class_obstaculo.html", "class_obstaculo" ] ] ], [ "Patricio.java", "_patricio_8java.html", [ [ "Patricio", "class_patricio.html", "class_patricio" ] ] ], [ "Piedrita.java", "_piedrita_8java.html", [ [ "Piedrita", "class_piedrita.html", "class_piedrita" ] ] ], [ "Play.java", "_play_8java.html", [ [ "Play", "class_play.html", "class_play" ] ] ], [ "Portador.java", "_portador_8java.html", [ [ "Portador", "class_portador.html", "class_portador" ] ] ], [ "Records.java", "_records_8java.html", [ [ "Records", "class_records.html", "class_records" ] ] ], [ "RecordUser.java", "_record_user_8java.html", [ [ "RecordUser", "class_record_user.html", "class_record_user" ] ] ], [ "Score2.java", "_score2_8java.html", [ [ "Score2", "class_score2.html", "class_score2" ] ] ], [ "SimpleTimer.java", "_simple_timer_8java.html", [ [ "SimpleTimer", "class_simple_timer.html", "class_simple_timer" ] ] ] ];
JavaScript
(function ($) { // Behavior to load FlexSlider Drupal.behaviors.flexslider = { attach: function(context, settings) { $('.flexslider', context).once('flexslider', function() { $(this).each(function() { var $this = $(this); var id = $this.attr('id'); if (settings.flexslider !== undefined) { var optionset = settings.flexslider.instances[id]; if (optionset) { $this.flexslider(settings.flexslider.optionsets[optionset]); } else { $this.flexslider(); } } }); // Remove width/height attributes $(this).find('ul.slides li img').removeAttr('height'); $(this).find('ul.slides li img').removeAttr('width'); }); } }; }(jQuery));
JavaScript
(function ($) { // @todo convert to use Drupal.behaviors // @todo add configuration options // Register callback to save references to flexslider instances. Allows // Views Slideshow controls to affect the slider function flexslider_views_slideshow_register(fullId, slider) { Drupal.flexsliderViewsSlideshow.active = Drupal.flexsliderViewsSlideshow.active || {}; Drupal.flexsliderViewsSlideshow.active[fullId] = slider; } Drupal.behaviors.flexsliderViewsSlideshow = { attach: function (context) { $('.flexslider_views_slideshow_main:not(.flexslider_views_slideshow-processed)', context).addClass('flexslider_views_slideshow-processed').each(function() { // Get the ID of the slideshow var fullId = '#' + $(this).attr('id'); // Create settings container var settings = Drupal.settings.flexslider_views_slideshow[fullId]; //console.log(settings); // @todo map the settings from the form to their javascript equivalents settings.targetId = fullId; settings.loaded = false; // Assign default settings settings.opts = { animation:settings.animation, slideDirection:settings.slideDirection, slideshow:settings.slideshow, slideshowSpeed:settings.slideshowSpeed, animationDuration:settings.animationDuration, directionNav:settings.directionNav, controlNav:settings.controlNav, keyboardNav:settings.keyboardNav, mousewheel:settings.mousewheel, prevText:settings.prevText, nextText:settings.nextText, pausePlay:settings.pausePlay, pauseText:settings.pauseText, playText:settings.playText, randomize:settings.randomize, slideToStart:settings.slideToStart, animationLoop:settings.animationLoop, pauseOnAction:settings.pauseOnAction, pauseOnHover:settings.pauseOnHover, controlsContainer:settings.controlsContainer, manualControls:settings.manualControls, start: function(slider) { flexslider_views_slideshow_register(fullId, slider); } }; Drupal.flexsliderViewsSlideshow.load(fullId); }); } }; // Initialize the flexslider object Drupal.flexsliderViewsSlideshow = Drupal.flexsliderViewsSlideshow || {}; // Load mapping from Views Slideshow to FlexSlider Drupal.flexsliderViewsSlideshow.load = function(fullId) { var settings = Drupal.settings.flexslider_views_slideshow[fullId]; // Ensure the slider isn't already loaded if (!settings.loaded) { $(settings.targetId + " .flexslider").flexslider(settings.opts); settings.loaded = true; } } // Pause mapping from Views Slideshow to FlexSlider Drupal.flexsliderViewsSlideshow.pause = function (options) { Drupal.flexsliderViewsSlideshow.active['#flexslider_views_slideshow_main_' + options.slideshowID].pause(); Drupal.flexsliderViewsSlideshow.active['#flexslider_views_slideshow_main_' + options.slideshowID].manualPause = true; } // Play mapping from Views Slideshow to FlexSlider Drupal.flexsliderViewsSlideshow.play = function (options) { Drupal.flexsliderViewsSlideshow.active['#flexslider_views_slideshow_main_' + options.slideshowID].resume(); Drupal.flexsliderViewsSlideshow.active['#flexslider_views_slideshow_main_' + options.slideshowID].manualPause = false; } Drupal.flexsliderViewsSlideshow.nextSlide = function (options) { var target = Drupal.flexsliderViewsSlideshow.active['#flexslider_views_slideshow_main_' + options.slideshowID].getTarget('next'); if (Drupal.flexsliderViewsSlideshow.active['#flexslider_views_slideshow_main_' + options.slideshowID].canAdvance(target)) { Drupal.flexsliderViewsSlideshow.active['#flexslider_views_slideshow_main_' + options.slideshowID].flexAnimate(target, Drupal.flexsliderViewsSlideshow.active['#flexslider_views_slideshow_main_' + options.slideshowID].vars.pauseOnAction); } } Drupal.flexsliderViewsSlideshow.previousSlide = function (options) { var target = Drupal.flexsliderViewsSlideshow.active['#flexslider_views_slideshow_main_' + options.slideshowID].getTarget('prev'); if (Drupal.flexsliderViewsSlideshow.active['#flexslider_views_slideshow_main_' + options.slideshowID].canAdvance(target)) { Drupal.flexsliderViewsSlideshow.active['#flexslider_views_slideshow_main_' + options.slideshowID].flexAnimate(target, Drupal.flexsliderViewsSlideshow.active['#flexslider_views_slideshow_main_' + options.slideshowID].vars.pauseOnAction); } } // @todo add support for jquery mobile page init })(jQuery);
JavaScript
/** * @file * Adds the collapsible functionality to the rules debug log. */ // Registers the rules namespace. Drupal.rules = Drupal.rules || {}; (function($) { Drupal.behaviors.rules_debug_log = { attach: function(context) { $('.rules-debug-open').click(function () { var icon = $(this).children('span.ui-icon'); if ($(this).next().is(':hidden')) { Drupal.rules.changeDebugIcon(icon, true); } else { Drupal.rules.changeDebugIcon(icon, false); } $(this).next().toggle(); }).next().hide(); $('.rules-debug-open-main').click(function () { var icon = $(this).children('span.ui-icon'); if ($(this).parent().next().is(':hidden')) { Drupal.rules.changeDebugIcon(icon, true); $(this).parent().children('.rules-debug-open-all').text(Drupal.t('-Close all-')); } else { Drupal.rules.changeDebugIcon(icon, false); $(this).parent().children('.rules-debug-open-all').text(Drupal.t('-Open all-')); } $(this).parent().next().toggle(); }).parent().next().hide(); $('.rules-debug-open-all').click(function() { if ($('.rules-debug-open-main').parent().next().is(':hidden')) { $('.rules-debug-open').next().show(); Drupal.rules.changeDebugIcon($('.rules-debug-open').children('span.ui-icon'), true); $('.rules-debug-open-main').parent().next().show(); Drupal.rules.changeDebugIcon($(this).prev().children('span.ui-icon'), true); $(this).text(Drupal.t('-Close all-')); } else { $('.rules-debug-open-main').parent().next().hide(); Drupal.rules.changeDebugIcon($('.rules-debug-open-main').children('span.ui-icon'), false); $(this).text(Drupal.t('-Open all-')); $('.rules-debug-open').next().hide(); Drupal.rules.changeDebugIcon($(this).prev().children('span.ui-icon'), false); } }); } }; /** * Changes the icon of a collapsible div. */ Drupal.rules.changeDebugIcon = function(item, open) { if (open == true) { item.removeClass('ui-icon-triangle-1-e'); item.addClass('ui-icon-triangle-1-s'); } else { item.removeClass('ui-icon-triangle-1-s'); item.addClass('ui-icon-triangle-1-e'); } } })(jQuery);
JavaScript
// Registers the rules namespace. Drupal.rules = Drupal.rules || {}; (function($) { Drupal.behaviors.rules_autocomplete = { attach: function(context) { var autocomplete_settings = Drupal.settings.rules_autocomplete; $('input.rules-autocomplete').once(function() { var input = this; new Drupal.rules.autocomplete(input, autocomplete_settings[$(input).attr('id')]); }); } }; /** * Rules autocomplete object. */ Drupal.rules.autocomplete = function(input, settings) { this.id = settings.inputId; this.uri = settings.source; this.jqObject = $('#' + this.id); this.cache = new Array(); this.jqObject.addClass('ui-corner-left'); this.opendByFocus = false; this.focusOpens = true; this.groupSelected = false; this.button = $('<span>&nbsp;</span>'); this.button.attr( { 'tabIndex': -1, 'title': 'Show all items' }); this.button.insertAfter(this.jqObject); this.button.button( { icons: { primary: 'ui-icon-triangle-1-s' }, text: false }); // Don't round the left corners. this.button.removeClass('ui-corner-all'); this.button.addClass('ui-corner-right ui-button-icon rules-autocomplete-button'); this.jqObject.autocomplete(); this.jqObject.autocomplete("option", "minLength", 0); // Add a custom class, so we can style the autocomplete box without // interfering with other jquery autocomplete widgets. this.jqObject.autocomplete("widget").addClass('rules-autocomplete'); // Save the current rules_autocomplete object, so it can be used in // handlers. var instance = this; // Event handlers this.jqObject.focus(function() { if (instance.focusOpens) { instance.toggle(); instance.opendByFocus = true; } else { instance.focusOpens = true; } }); // Needed when the window is closed but the textfield has the focus. this.jqObject.click(function() { // Since the focus event happens earlier then the focus event, we need to // check here, if the window should be opened. if (!instance.opendByFocus) { instance.toggle(); } else { instance.opendByFocus = false; } }); this.jqObject.bind("autocompleteselect", function(event, ui) { // If a group was selected then set the groupSelected to true for the // overriden close function from jquery autocomplete. if (ui.item.value.substring(ui.item.value.length - 1, ui.item.value.length) == ":") { instance.groupSelected = true; } instance.focusOpens = false; instance.opendByFocus = false; }); this.jqObject.autocomplete("option", "source", function(request, response) { if (request.term in instance.cache) { response(instance.cache[request.term]); return; } $.ajax( { url: instance.uri + '/' + request.term, dataType: "json", success: function(data) { instance.success(data, request, response); } }); }); // Since jquery autocomplete by default strips html text by using .text() // we need our own _renderItem function to display html content. this.jqObject.data("autocomplete")._renderItem = function(ul, item) { return $("<li></li>").data("item.autocomplete", item).append("<a>" + item.label + "</a>").appendTo(ul); }; // Override close function this.jqObject.data("autocomplete").close = function (event) { var value = this.element.val(); // If the selector is not a group, then trigger the close event an and // hide the menu. if (value === undefined || instance.groupSelected === false) { clearTimeout(this.closing); if (this.menu.element.is(":visible")) { this._trigger("close", event); this.menu.element.hide(); this.menu.deactivate(); } } else { // Else keep all open and trigger a search for the group. instance.jqObject.autocomplete("search", instance.jqObject.val()); // After the suggestion box was opened again, we want to be able to // close it. instance.groupSelected = false; } }; this.button.click(function() { instance.toggle(); }); }; /** * Success function for Rules autocomplete object. */ Drupal.rules.autocomplete.prototype.success = function(data, request, response) { var list = new Array(); jQuery.each(data, function(index, value) { list.push( { label: value, value: index }); }); this.cache[request.term] = list; response(list); }; /** * Open the autocomplete window. * @param searchFor The term for will be searched for. If undefined then the * entered input text will be used. */ Drupal.rules.autocomplete.prototype.open = function(searchFor) { // If searchFor is undefined, we want to search for the passed argument. this.jqObject.autocomplete("search", ((searchFor === undefined) ? this.jqObject.val() : searchFor)); this.button.addClass("ui-state-focus"); }; /** * Close the autocomplete window. */ Drupal.rules.autocomplete.prototype.close = function() { this.jqObject.autocomplete("close"); this.button.removeClass("ui-state-focus"); }; /** * Toogle the autcomplete window. */ Drupal.rules.autocomplete.prototype.toggle = function() { if (this.jqObject.autocomplete("widget").is(":visible")) { this.close(); this.focusOpens = true; } else { var groups = this.jqObject.val().split(":"); var selector = ""; for (var i=0; i<groups.length-1; i++) { selector = selector.concat(groups[i]) + ":"; } this.focusOpens = false; this.jqObject.focus(); this.open(selector); } }; })(jQuery);
JavaScript
/* $Id: lightbox2.js,v 1.1.4.39 2010/06/07 15:24:24 snpower Exp $ */ // start jQuery block (function ($) { function alt_layout_handler(event) { if ($("input[name=lightbox2_lite]:checked").val() != 1) { if ($("input[name=lightbox2_use_alt_layout]:checked").val() == 1) { $("input[name=lightbox2_force_show_nav]").attr("disabled", "disabled"); } else { $("input[name=lightbox2_force_show_nav]").removeAttr("disabled"); } } } function zoom_handler(event) { if ($("input[name=lightbox2_disable_resize]:checked").val() == 1) { $("input[name=lightbox2_disable_zoom]").attr("disabled", "disabled"); } else { $("input[name=lightbox2_disable_zoom]").removeAttr("disabled"); } } function lightbox2_lite_general_handler(event) { // Enable / disable the non-lightbox2-lite options. if ($("input[name=lightbox2_lite]:checked").val() == 1) { $("input[name=lightbox2_use_alt_layout]").attr("disabled", "disabled"); $("input[name=lightbox2_force_show_nav]").attr("disabled", "disabled"); $("input[name=lightbox2_loop_items]").attr("disabled", "disabled"); $("input[name=lightbox2_disable_resize]").attr("disabled", "disabled"); $("input[name=lightbox2_disable_zoom]").attr("disabled", "disabled"); $("input[name=lightbox2_enable_video]").attr("disabled", "disabled"); $("input[name=lightbox2_enable_login]").attr("disabled", "disabled"); $("input[name=lightbox2_enable_contact]").attr("disabled", "disabled"); $("input[name=lightbox2_node_link_text]").attr("disabled", "disabled"); $("input[name=lightbox2_download_link_text]").attr("disabled", "disabled"); $("input[name=lightbox2_node_link_target]").attr("disabled", "disabled"); $("input[name=lightbox2_image_count_str]").attr("disabled", "disabled"); $("input[name=lightbox2_video_count_str]").attr("disabled", "disabled"); $("input[name=lightbox2_page_count_str]").attr("disabled", "disabled"); $("select[name=lightbox2_display_image_size]").attr("disabled", "disabled"); $("select[name='lightbox2_trigger_image_size[]']").attr("disabled", "disabled"); $("select[name=lightbox2_image_ncck_group_node_id]").attr("disabled", "disabled"); $("select[name=lightbox2_imagefield_group_node_id]").attr("disabled", "disabled"); $("input[name=lightbox2_imagefield_use_node_title]").attr("disabled", "disabled"); $("input[name=lightbox2_disable_close_click]").attr("disabled", "disabled"); $("input[name=lightbox2_border_size]").attr("disabled", "disabled"); $("input[name=lightbox2_box_color]").attr("disabled", "disabled"); $("input[name=lightbox2_font_color]").attr("disabled", "disabled"); $("input[name=lightbox2_top_position]").attr("disabled", "disabled"); $("select[name=lightbox2_resize_sequence]").attr("disabled", "disabled"); $("input[name=lightbox2_resize_speed]").attr("disabled", "disabled"); $("input[name=lightbox2_fadein_speed]").attr("disabled", "disabled"); $("input[name=lightbox2_slidedown_speed]").attr("disabled", "disabled"); } else { $("input[name=lightbox2_use_alt_layout]").removeAttr("disabled"); $("input[name=lightbox2_force_show_nav]").removeAttr("disabled"); $("input[name=lightbox2_loop_items]").removeAttr("disabled"); $("input[name=lightbox2_disable_resize]").removeAttr("disabled"); $("input[name=lightbox2_disable_zoom]").removeAttr("disabled"); $("input[name=lightbox2_node_link_text]").removeAttr("disabled"); $("input[name=lightbox2_download_link_text]").removeAttr("disabled"); $("input[name=lightbox2_node_link_target]").removeAttr("disabled"); $("input[name=lightbox2_enable_video]").removeAttr("disabled"); $("input[name=lightbox2_enable_login]").removeAttr("disabled"); $("input[name=lightbox2_enable_contact]").removeAttr("disabled"); $("input[name=lightbox2_image_count_str]").removeAttr("disabled"); $("input[name=lightbox2_video_count_str]").removeAttr("disabled"); $("input[name=lightbox2_page_count_str]").removeAttr("disabled"); $("select[name=lightbox2_display_image_size]").removeAttr("disabled"); $("select[name='lightbox2_trigger_image_size[]']").removeAttr("disabled"); $("select[name=lightbox2_image_ncck_group_node_id]").removeAttr("disabled"); $("select[name=lightbox2_imagefield_group_node_id]").removeAttr("disabled"); $("input[name=lightbox2_imagefield_use_node_title]").removeAttr("disabled"); $("input[name=lightbox2_disable_close_click]").removeAttr("disabled"); $("input[name=lightbox2_border_size]").removeAttr("disabled"); $("input[name=lightbox2_box_color]").removeAttr("disabled"); $("input[name=lightbox2_font_color]").removeAttr("disabled"); $("input[name=lightbox2_top_position]").removeAttr("disabled"); $("select[name=lightbox2_resize_sequence]").removeAttr("disabled"); $("input[name=lightbox2_resize_speed]").removeAttr("disabled"); $("input[name=lightbox2_fadein_speed]").removeAttr("disabled"); $("input[name=lightbox2_slidedown_speed]").removeAttr("disabled"); alt_layout_handler(); zoom_handler(); } } function image_node_handler(event) { // Image node, flickr, gallery2, inline and custom images stuff. if ($("input[name=lightbox2_lite]").val() != 1) { // Image node only stuff. if ($("select[name=lightbox2_image_node]").val() !== 0) { $("input[name=lightbox2_disable_nested_galleries]").removeAttr("disabled"); $("select[name=lightbox2_display_image_size]").removeAttr("disabled"); $("select[name='lightbox2_trigger_image_size[]']").removeAttr("disabled"); } else { $("input[name=lightbox2_disable_nested_galleries]").attr("disabled", "disabled"); $("select[name=lightbox2_display_image_size]").attr("disabled", "disabled"); $("select[name='lightbox2_trigger_image_size[]']").attr("disabled", "disabled"); } } } function lightbox2_lite_auto_handler(event) { // Enable / disable the image node options. if ($("input[name=lightbox2_lite]").val() == 1) { // Disable iframe options. $("input[name=lightbox2_default_frame_width]").attr("disabled", "disabled"); $("input[name=lightbox2_default_frame_height]").attr("disabled", "disabled"); $("input[name=lightbox2_frame_border]").attr("disabled", "disabled"); // Disable slideshow options. $("input[name=lightbox2_slideshow_interval]").attr("disabled", "disabled"); $("input[name=lightbox2_slideshow_automatic_start]").attr("disabled", "disabled"); $("input[name=lightbox2_slideshow_automatic_exit]").attr("disabled", "disabled"); $("input[name=lightbox2_slideshow_show_play_pause]").attr("disabled", "disabled"); $("input[name=lightbox2_slideshow_pause_on_next_click]").attr("disabled", "disabled"); $("input[name=lightbox2_slideshow_pause_on_previous_click]").attr("disabled", "disabled"); $("input[name=lightbox2_loop_slides]").attr("disabled", "disabled"); // Disable automatic image handling options. $("select[name=lightbox2_image_node]").attr("disabled", "disabled"); $("select[name=lightbox2_display_image_size]").attr("disabled", "disabled"); $("select[name='lightbox2_trigger_image_size[]']").attr("disabled", "disabled"); $("select[name=lightbox2_flickr]").attr("disabled", "disabled"); $("select[name=lightbox2_gallery2_blocks]").attr("disabled", "disabled"); $("select[name=lightbox2_image_assist_custom]").attr("disabled", "disabled"); $("select[name=lightbox2_inline]").attr("disabled", "disabled"); $("select[name=lightbox2_custom_class_handler]").attr("disabled", "disabled"); $("textarea[name=lightbox2_custom_trigger_classes]").attr("disabled", "disabled"); $("input[name=lightbox2_disable_nested_galleries]").attr("disabled", "disabled"); $("input[name=lightbox2_disable_nested_acidfree_galleries]").attr("disabled", "disabled"); $("input[name=lightbox2_enable_acidfree_videos]").attr("disabled", "disabled"); } else { // Enable iframe options. $("input[name=lightbox2_default_frame_width]").removeAttr("disabled"); $("input[name=lightbox2_default_frame_height]").removeAttr("disabled"); $("input[name=lightbox2_frame_border]").removeAttr("disabled"); // Enable slideshow options. $("input[name=lightbox2_slideshow_interval]").removeAttr("disabled"); $("input[name=lightbox2_slideshow_automatic_start]").removeAttr("disabled"); $("input[name=lightbox2_slideshow_automatic_exit]").removeAttr("disabled"); $("input[name=lightbox2_slideshow_show_play_pause]").removeAttr("disabled"); $("input[name=lightbox2_slideshow_pause_on_next_click]").removeAttr("disabled"); $("input[name=lightbox2_slideshow_pause_on_previous_click]").removeAttr("disabled"); $("input[name=lightbox2_loop_slides]").removeAttr("disabled"); // Enable automatic image handling options. $("select[name=lightbox2_image_node]").removeAttr("disabled"); $("select[name=lightbox2_flickr]").removeAttr("disabled"); $("select[name=lightbox2_gallery2_blocks]").removeAttr("disabled"); $("select[name=lightbox2_image_assist_custom]").removeAttr("disabled"); $("select[name=lightbox2_inline]").removeAttr("disabled"); $("select[name=lightbox2_custom_class_handler]").removeAttr("disabled"); $("textarea[name=lightbox2_custom_trigger_classes]").removeAttr("disabled"); $("select[name=lightbox2_display_image_size]").removeAttr("disabled"); $("select[name='lightbox2_trigger_image_size[]']").removeAttr("disabled"); $("input[name=lightbox2_disable_nested_galleries]").removeAttr("disabled"); $("input[name=lightbox2_disable_nested_acidfree_galleries]").removeAttr("disabled"); $("input[name=lightbox2_enable_acidfree_videos]").removeAttr("disabled"); image_node_handler(); } } $(document).ready(function () { // Handle lightbox2_settings_form. lightbox2_lite_general_handler(); lightbox2_lite_auto_handler(); image_node_handler(); $("input[name=lightbox2_lite]").bind("click", lightbox2_lite_general_handler); $("input[name=lightbox2_use_alt_layout]").bind("click", alt_layout_handler); $("input[name=lightbox2_disable_resize]").bind("click", zoom_handler); $("select[name=lightbox2_image_node]").bind("click", image_node_handler); $("select[name=lightbox2_flickr]").bind("click", image_node_handler); $("select[name=lightbox2_gallery2_blocks]").bind("click", image_node_handler); $("select[name=lightbox2_image_assist_custom]").bind("click", image_node_handler); $("select[name=lightbox2_inline]").bind("click", image_node_handler); $("select[name=lightbox2_custom_class_handler]").bind("change", image_node_handler); $("textarea[name=lightbox2_custom_trigger_classes]").bind("change", image_node_handler); }); //End jQuery block }(jQuery));
JavaScript
// Image Node Auto-Format with Auto Image Grouping. // Original version by Steve McKenzie. // Altered by Stella Power for jQuery version. (function ($) { function parse_url(url, param) { param = param.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); url = url.replace(/&amp;/, "&"); var regexS = "[\\?&]"+param+"=([^&#]*)"; var regex = new RegExp(regexS); var results = regex.exec(url); if (results === null) { return ""; } else { return results[1]; } } function lightbox2_init_triggers(classes, rel_type, custom_class) { if (classes == '' || rel_type == 0) { return; } var settings = Drupal.settings.lightbox2; var link_target = ""; if (settings.node_link_target !== 0) { link_target = 'target="'+ settings.node_link_target +'"'; } $("a:has("+classes+")").each(function(i) { if ((!settings.disable_for_gallery_lists && !settings.disable_for_acidfree_gallery_lists) || (!$(this).parents("td.giAlbumCell").attr("class") && !$(this).parents(".galleries").length && !$(this).parents(".acidfree-folder").length && !$(this).parents(".acidfree-list").length) || ($(this).parents(".galleries").length && !settings.disable_for_gallery_lists) || (($(this).parents(".acidfree-folder").length || $(this).parents(".acidfree-list").length) && !settings.disable_for_acidfree_gallery_lists)) { var child = $(this).find(classes); // Ensure the child has a class attribute we can work with. if ($(child).attr("class")) { // Set the alt text. var alt = $(child).attr("alt"); if (!alt) { alt = ""; } // Set the image node link text. var link_text = settings.node_link_text; var download_link_text = settings.download_link_text; var rewrite = 1; // Set the rel attribute. var rel = "lightbox"; var lightframe = false; if (rel_type == "lightframe_ungrouped") { rel = "lightframe[]"; lightframe = true; } else if (rel_type == "lightframe") { lightframe = true; } else if (rel_type == "lightbox_ungrouped") { rel = "lightbox[]"; } if (rel_type != "lightbox_ungrouped" && rel_type != "lightframe_ungrouped") { rel = rel_type + "[" + $(child).attr("class") + "]"; } // Set the basic href attribute - need to ensure there's no language // string (e.g. /en) prepended to the URL. var id = null; var href = $(child).attr("src"); var download = null; var orig_href = $(this).attr("href"); var pattern = new RegExp(settings.file_path); if (orig_href.match(pattern)) { var lang_pattern = new RegExp(Drupal.settings.basePath + "\\w\\w\\/"); orig_href = orig_href.replace(lang_pattern, Drupal.settings.basePath); } var frame_href = orig_href; // Handle flickr images. if ($(child).attr("class").match("flickr-photo-img") || $(child).attr("class").match("flickr-photoset-img")) { href = $(child).attr("src").replace("_s.", ".").replace("_t.", ".").replace("_m.", ".").replace("_b.", "."); if (rel_type != "lightbox_ungrouped" && rel_type != "lightframe_ungrouped") { rel = rel_type + "[flickr]"; if ($(child).parents("div.block-flickr").attr("class")) { id = $(child).parents("div.block-flickr").attr("id"); rel = rel_type + "["+ id +"]"; } } download = href; } // Handle "image-img_assist_custom" images. else if ($(child).filter("img[class*=img_assist_custom]").size()) { // Image assist uses "+" signs for spaces which doesn't work for // normal links. if (settings.display_image_size != "original") { orig_href = orig_href.replace(/\+/, " "); href = $(child).attr("src").replace(new RegExp("\\.img_assist_custom-[0-9]+x[0-9]+"), ((settings.display_image_size === "")?settings.display_image_size:"."+ settings.display_image_size)); if (rel_type != "lightbox_ungrouped" && rel_type != "lightframe_ungrouped") { rel = rel_type + "[node_images]"; } if (lightframe) { frame_href = orig_href + "/lightbox2"; } } else { rewrite = 0; } } // Handle "inline" images. else if ($(child).attr("class").match("inline")) { href = orig_href; } // Handle gallery2 block images. else if ($(child).attr("class").match("ImageFrame_image") || $(child).attr("class").match("ImageFrame_none")) { var thumb_id = parse_url(href, "g2_itemId"); var new_id = parse_url(orig_href, "g2_itemId"); if (new_id && thumb_id) { var g2pattern = new RegExp("g2_itemId="+thumb_id); var replacement = "g2_itemId="+ new_id; href = href.replace(g2pattern, replacement); } rel = rel_type + "[gallery2]"; if ($(child).parents("div.block-gallery").attr("class")) { id = $(child).parents("div.block-gallery").attr("id"); rel = rel_type + "["+ id +"]"; } download = href; } // Set the href attribute. else if (settings.image_node_sizes != '()' && !custom_class) { if (settings.display_image_size != "original") { href = $(child).attr("src").replace(new RegExp(settings.image_node_sizes), ((settings.display_image_size === "")?settings.display_image_size:"."+ settings.display_image_size)).replace(/(image\/view\/\d+)(\/[\w\-]*)/, ((settings.display_image_size === "")?"$1/_original":"$1/"+ settings.display_image_size)); if (rel_type != "lightbox_ungrouped" && rel_type != "lightframe_ungrouped") { rel = rel_type + "[node_images]"; if ($(child).parents("div.block-multiblock,div.block-image").attr("class")) { id = $(child).parents("div.block-multiblock,div.block-image").attr("id"); rel = rel_type + "["+ id +"]"; } } download = $(child).attr("src").replace(new RegExp(settings.image_node_sizes), "").replace(/(image\/view\/\d+)(\/[\w\-]*)/, "$1/_original"); if (lightframe) { frame_href = orig_href + "/lightbox2"; } } else { rewrite = 0; } } // Modify the image url. var img_title = $(child).attr("title"); if (!img_title) { img_title = $(this).attr("title"); if (!img_title) { img_title = $(child).attr("alt"); } $(child).attr({title: img_title}); } if (lightframe) { href = frame_href; } if (rewrite) { if (!custom_class) { var title_link = ""; if (link_text.length) { title_link = "<br /><br /><a href=\"" + orig_href + "\" id=\"lightbox2-node-link-text\" "+ link_target +" >"+ link_text + "</a>"; } if (download_link_text.length && download) { title_link = title_link + " - <a href=\"" + download + "\" id=\"lightbox2-download-link-text\" target=\"_blank\">" + download_link_text + "</a>"; } rel = rel + "[" + img_title + title_link + "]"; $(this).attr({ rel: rel, href: href }); } else { if (rel_type != "lightbox_ungrouped" && rel_type != "lightframe_ungrouped") { rel = rel_type + "[" + $(child).attr("class") + "]"; if ($(child).parents("div.block-image").attr("class")) { id = $(child).parents("div.block-image").attr("id"); rel = rel_type + "["+ id +"]"; } } rel = rel + "[" + img_title + "]"; $(this).attr({ rel: rel, href: orig_href }); } } } } }); } function lightbox2_image_nodes() { var settings = Drupal.settings.lightbox2; // Don't do it on the image assist popup selection screen. var img_assist = document.getElementById("img_assist_thumbs"); if (!img_assist) { // Select the enabled image types. lightbox2_init_triggers(settings.trigger_lightbox_classes, "lightbox_ungrouped"); lightbox2_init_triggers(settings.custom_trigger_classes, settings.custom_class_handler, true); lightbox2_init_triggers(settings.trigger_lightbox_group_classes, "lightbox"); lightbox2_init_triggers(settings.trigger_slideshow_classes, "lightshow"); lightbox2_init_triggers(settings.trigger_lightframe_classes, "lightframe_ungrouped"); lightbox2_init_triggers(settings.trigger_lightframe_group_classes, "lightframe"); } } Drupal.behaviors.initAutoLightbox = { attach: function(context, settings) { lightbox2_image_nodes(); } }; //End jQuery block }(jQuery));
JavaScript
/* $Id: lightbox.js,v 1.5.2.6.2.136 2010/09/24 08:39:40 snpower Exp $ */ /** * jQuery Lightbox * @author * Stella Power, <http://drupal.org/user/66894> * * Based on Lightbox v2.03.3 by Lokesh Dhakar * <http://www.huddletogether.com/projects/lightbox2/> * Also partially based on the jQuery Lightbox by Warren Krewenki * <http://warren.mesozen.com> * * Permission has been granted to Mark Ashmead & other Drupal Lightbox2 module * maintainers to distribute this file via Drupal.org * Under GPL license. * * Slideshow, iframe and video functionality added by Stella Power. */ var Lightbox; (function($) { Lightbox = { auto_modal : false, overlayOpacity : 0.8, // Controls transparency of shadow overlay. overlayColor : '000', // Controls colour of shadow overlay. disableCloseClick : true, // Controls the order of the lightbox resizing animation sequence. resizeSequence: 0, // 0: simultaneous, 1: width then height, 2: height then width. resizeSpeed: 'normal', // Controls the speed of the lightbox resizing animation. fadeInSpeed: 'normal', // Controls the speed of the image appearance. slideDownSpeed: 'slow', // Controls the speed of the image details appearance. minWidth: 240, borderSize : 10, boxColor : 'fff', fontColor : '000', topPosition : '', infoHeight: 20, alternative_layout : false, imageArray : [], imageNum : null, total : 0, activeImage : null, inprogress : false, disableResize : false, disableZoom : false, isZoomedIn : false, rtl : false, loopItems : false, keysClose : ['c', 'x', 27], keysPrevious : ['p', 37], keysNext : ['n', 39], keysZoom : ['z'], keysPlayPause : [32], // Slideshow options. slideInterval : 5000, // In milliseconds. showPlayPause : true, autoStart : true, autoExit : true, pauseOnNextClick : false, // True to pause the slideshow when the "Next" button is clicked. pauseOnPrevClick : true, // True to pause the slideshow when the "Prev" button is clicked. slideIdArray : [], slideIdCount : 0, isSlideshow : false, isPaused : false, loopSlides : false, // Iframe options. isLightframe : false, iframe_width : 600, iframe_height : 400, iframe_border : 1, // Video and modal options. enableVideo : false, flvPlayer : '/flvplayer.swf', flvFlashvars : '', isModal : false, isVideo : false, videoId : false, modalWidth : 400, modalHeight : 400, modalHTML : null, // initialize() // Constructor runs on completion of the DOM loading. // The function inserts html at the bottom of the page which is used // to display the shadow overlay and the image container. initialize: function() { var s = Drupal.settings.lightbox2; Lightbox.overlayOpacity = s.overlay_opacity; Lightbox.overlayColor = s.overlay_color; Lightbox.disableCloseClick = s.disable_close_click; Lightbox.resizeSequence = s.resize_sequence; Lightbox.resizeSpeed = s.resize_speed; Lightbox.fadeInSpeed = s.fade_in_speed; Lightbox.slideDownSpeed = s.slide_down_speed; Lightbox.borderSize = s.border_size; Lightbox.boxColor = s.box_color; Lightbox.fontColor = s.font_color; Lightbox.topPosition = s.top_position; Lightbox.rtl = s.rtl; Lightbox.loopItems = s.loop_items; Lightbox.keysClose = s.keys_close.split(" "); Lightbox.keysPrevious = s.keys_previous.split(" "); Lightbox.keysNext = s.keys_next.split(" "); Lightbox.keysZoom = s.keys_zoom.split(" "); Lightbox.keysPlayPause = s.keys_play_pause.split(" "); Lightbox.disableResize = s.disable_resize; Lightbox.disableZoom = s.disable_zoom; Lightbox.slideInterval = s.slideshow_interval; Lightbox.showPlayPause = s.show_play_pause; Lightbox.showCaption = s.show_caption; Lightbox.autoStart = s.slideshow_automatic_start; Lightbox.autoExit = s.slideshow_automatic_exit; Lightbox.pauseOnNextClick = s.pause_on_next_click; Lightbox.pauseOnPrevClick = s.pause_on_previous_click; Lightbox.loopSlides = s.loop_slides; Lightbox.alternative_layout = s.use_alt_layout; Lightbox.iframe_width = s.iframe_width; Lightbox.iframe_height = s.iframe_height; Lightbox.iframe_border = s.iframe_border; Lightbox.enableVideo = s.enable_video; if (s.enable_video) { Lightbox.flvPlayer = s.flvPlayer; Lightbox.flvFlashvars = s.flvFlashvars; } // Make the lightbox divs. var layout_class = (s.use_alt_layout ? 'lightbox2-alt-layout' : 'lightbox2-orig-layout'); var output = '<div id="lightbox2-overlay" style="display: none;"></div>\ <div id="lightbox" style="display: none;" class="' + layout_class + '">\ <div id="outerImageContainer"></div>\ <div id="imageDataContainer" class="clearfix">\ <div id="imageData"></div>\ </div>\ </div>'; var loading = '<div id="loading"><a href="#" id="loadingLink"></a></div>'; var modal = '<div id="modalContainer" style="display: none;"></div>'; var frame = '<div id="frameContainer" style="display: none;"></div>'; var imageContainer = '<div id="imageContainer" style="display: none;"></div>'; var details = '<div id="imageDetails"></div>'; var bottomNav = '<div id="bottomNav"></div>'; var image = '<img id="lightboxImage" alt="" />'; var hoverNav = '<div id="hoverNav"><a id="prevLink" href="#"></a><a id="nextLink" href="#"></a></div>'; var frameNav = '<div id="frameHoverNav"><a id="framePrevLink" href="#"></a><a id="frameNextLink" href="#"></a></div>'; var hoverNav = '<div id="hoverNav"><a id="prevLink" title="' + Drupal.t('Previous') + '" href="#"></a><a id="nextLink" title="' + Drupal.t('Next') + '" href="#"></a></div>'; var frameNav = '<div id="frameHoverNav"><a id="framePrevLink" title="' + Drupal.t('Previous') + '" href="#"></a><a id="frameNextLink" title="' + Drupal.t('Next') + '" href="#"></a></div>'; var caption = '<span id="caption"></span>'; var numberDisplay = '<span id="numberDisplay"></span>'; var close = '<a id="bottomNavClose" title="' + Drupal.t('Close') + '" href="#"></a>'; var zoom = '<a id="bottomNavZoom" href="#"></a>'; var zoomOut = '<a id="bottomNavZoomOut" href="#"></a>'; var pause = '<a id="lightshowPause" title="' + Drupal.t('Pause Slideshow') + '" href="#" style="display: none;"></a>'; var play = '<a id="lightshowPlay" title="' + Drupal.t('Play Slideshow') + '" href="#" style="display: none;"></a>'; $("body").append(output); $('#outerImageContainer').append(modal + frame + imageContainer + loading); if (!s.use_alt_layout) { $('#imageContainer').append(image + hoverNav); $('#imageData').append(details + bottomNav); $('#imageDetails').append(caption + numberDisplay); $('#bottomNav').append(frameNav + close + zoom + zoomOut + pause + play); } else { $('#outerImageContainer').append(bottomNav); $('#imageContainer').append(image); $('#bottomNav').append(close + zoom + zoomOut); $('#imageData').append(hoverNav + details); $('#imageDetails').append(caption + numberDisplay + pause + play); } // Setup onclick handlers. if (Lightbox.disableCloseClick) { $('#lightbox2-overlay').click(function() { Lightbox.end(); return false; } ).hide(); } $('#loadingLink, #bottomNavClose').click(function() { Lightbox.end('forceClose'); return false; } ); $('#prevLink, #framePrevLink').click(function() { Lightbox.changeData(Lightbox.activeImage - 1); return false; } ); $('#nextLink, #frameNextLink').click(function() { Lightbox.changeData(Lightbox.activeImage + 1); return false; } ); $('#bottomNavZoom').click(function() { Lightbox.changeData(Lightbox.activeImage, true); return false; } ); $('#bottomNavZoomOut').click(function() { Lightbox.changeData(Lightbox.activeImage, false); return false; } ); $('#lightshowPause').click(function() { Lightbox.togglePlayPause("lightshowPause", "lightshowPlay"); return false; } ); $('#lightshowPlay').click(function() { Lightbox.togglePlayPause("lightshowPlay", "lightshowPause"); return false; } ); // Fix positioning. $('#prevLink, #nextLink, #framePrevLink, #frameNextLink').css({ 'paddingTop': Lightbox.borderSize + 'px'}); $('#imageContainer, #frameContainer, #modalContainer').css({ 'padding': Lightbox.borderSize + 'px'}); $('#outerImageContainer, #imageDataContainer, #bottomNavClose').css({'backgroundColor': '#' + Lightbox.boxColor, 'color': '#'+Lightbox.fontColor}); if (Lightbox.alternative_layout) { $('#bottomNavZoom, #bottomNavZoomOut').css({'bottom': Lightbox.borderSize + 'px', 'right': Lightbox.borderSize + 'px'}); } else if (Lightbox.rtl == 1 && $.browser.msie) { $('#bottomNavZoom, #bottomNavZoomOut').css({'left': '0px'}); } // Force navigation links to always be displayed if (s.force_show_nav) { $('#prevLink, #nextLink').addClass("force_show_nav"); } }, // initList() // Loops through anchor tags looking for 'lightbox', 'lightshow' and // 'lightframe', etc, references and applies onclick events to appropriate // links. You can rerun after dynamically adding images w/ajax. initList : function(context) { if (context == undefined || context == null) { context = document; } // Attach lightbox to any links with rel 'lightbox', 'lightshow' or // 'lightframe', etc. $("a[rel^='lightbox']:not(.lightbox-processed), area[rel^='lightbox']:not(.lightbox-processed)", context).addClass('lightbox-processed').click(function(e) { if (Lightbox.disableCloseClick) { $('#lightbox').unbind('click'); $('#lightbox').click(function() { Lightbox.end('forceClose'); } ); } Lightbox.start(this, false, false, false, false); if (e.preventDefault) { e.preventDefault(); } return false; }); $("a[rel^='lightshow']:not(.lightbox-processed), area[rel^='lightshow']:not(.lightbox-processed)", context).addClass('lightbox-processed').click(function(e) { if (Lightbox.disableCloseClick) { $('#lightbox').unbind('click'); $('#lightbox').click(function() { Lightbox.end('forceClose'); } ); } Lightbox.start(this, true, false, false, false); if (e.preventDefault) { e.preventDefault(); } return false; }); $("a[rel^='lightframe']:not(.lightbox-processed), area[rel^='lightframe']:not(.lightbox-processed)", context).addClass('lightbox-processed').click(function(e) { if (Lightbox.disableCloseClick) { $('#lightbox').unbind('click'); $('#lightbox').click(function() { Lightbox.end('forceClose'); } ); } Lightbox.start(this, false, true, false, false); if (e.preventDefault) { e.preventDefault(); } return false; }); if (Lightbox.enableVideo) { $("a[rel^='lightvideo']:not(.lightbox-processed), area[rel^='lightvideo']:not(.lightbox-processed)", context).addClass('lightbox-processed').click(function(e) { if (Lightbox.disableCloseClick) { $('#lightbox').unbind('click'); $('#lightbox').click(function() { Lightbox.end('forceClose'); } ); } Lightbox.start(this, false, false, true, false); if (e.preventDefault) { e.preventDefault(); } return false; }); } $("a[rel^='lightmodal']:not(.lightbox-processed), area[rel^='lightmodal']:not(.lightbox-processed)", context).addClass('lightbox-processed').click(function(e) { $('#lightbox').unbind('click'); // Add classes from the link to the lightbox div - don't include lightbox-processed $('#lightbox').addClass($(this).attr('class')); $('#lightbox').removeClass('lightbox-processed'); Lightbox.start(this, false, false, false, true); if (e.preventDefault) { e.preventDefault(); } return false; }); $("#lightboxAutoModal:not(.lightbox-processed)", context).addClass('lightbox-processed').click(function(e) { Lightbox.auto_modal = true; $('#lightbox').unbind('click'); Lightbox.start(this, false, false, false, true); if (e.preventDefault) { e.preventDefault(); } return false; }); }, // start() // Display overlay and lightbox. If image is part of a set, add siblings to // imageArray. start: function(imageLink, slideshow, lightframe, lightvideo, lightmodal) { Lightbox.isPaused = !Lightbox.autoStart; // Replaces hideSelectBoxes() and hideFlash() calls in original lightbox2. Lightbox.toggleSelectsFlash('hide'); // Stretch overlay to fill page and fade in. var arrayPageSize = Lightbox.getPageSize(); $("#lightbox2-overlay").hide().css({ 'width': '100%', 'zIndex': '10090', 'height': arrayPageSize[1] + 'px', 'backgroundColor' : '#' + Lightbox.overlayColor }); // Detect OS X FF2 opacity + flash issue. if (lightvideo && this.detectMacFF2()) { $("#lightbox2-overlay").removeClass("overlay_default"); $("#lightbox2-overlay").addClass("overlay_macff2"); $("#lightbox2-overlay").css({'opacity' : null}); } else { $("#lightbox2-overlay").removeClass("overlay_macff2"); $("#lightbox2-overlay").addClass("overlay_default"); $("#lightbox2-overlay").css({'opacity' : Lightbox.overlayOpacity}); } $("#lightbox2-overlay").fadeIn(Lightbox.fadeInSpeed); Lightbox.isSlideshow = slideshow; Lightbox.isLightframe = lightframe; Lightbox.isVideo = lightvideo; Lightbox.isModal = lightmodal; Lightbox.imageArray = []; Lightbox.imageNum = 0; var anchors = $(imageLink.tagName); var anchor = null; var rel_parts = Lightbox.parseRel(imageLink); var rel = rel_parts["rel"]; var rel_group = rel_parts["group"]; var title = (rel_parts["title"] ? rel_parts["title"] : imageLink.title); var rel_style = null; var i = 0; if (rel_parts["flashvars"]) { Lightbox.flvFlashvars = Lightbox.flvFlashvars + '&' + rel_parts["flashvars"]; } // Set the title for image alternative text. var alt = imageLink.title; if (!alt) { var img = $(imageLink).find("img"); if (img && $(img).attr("alt")) { alt = $(img).attr("alt"); } else { alt = title; } } if ($(imageLink).attr('id') == 'lightboxAutoModal') { rel_style = rel_parts["style"]; Lightbox.imageArray.push(['#lightboxAutoModal > *', title, alt, rel_style, 1]); } else { // Handle lightbox images with no grouping. if ((rel == 'lightbox' || rel == 'lightshow') && !rel_group) { Lightbox.imageArray.push([imageLink.href, title, alt]); } // Handle other items with no grouping. else if (!rel_group) { rel_style = rel_parts["style"]; Lightbox.imageArray.push([imageLink.href, title, alt, rel_style]); } // Handle grouped items. else { // Loop through anchors and add them to imageArray. for (i = 0; i < anchors.length; i++) { anchor = anchors[i]; if (anchor.href && typeof(anchor.href) == "string" && $(anchor).attr('rel')) { var rel_data = Lightbox.parseRel(anchor); var anchor_title = (rel_data["title"] ? rel_data["title"] : anchor.title); img_alt = anchor.title; if (!img_alt) { var anchor_img = $(anchor).find("img"); if (anchor_img && $(anchor_img).attr("alt")) { img_alt = $(anchor_img).attr("alt"); } else { img_alt = title; } } if (rel_data["rel"] == rel) { if (rel_data["group"] == rel_group) { if (Lightbox.isLightframe || Lightbox.isModal || Lightbox.isVideo) { rel_style = rel_data["style"]; } Lightbox.imageArray.push([anchor.href, anchor_title, img_alt, rel_style]); } } } } // Remove duplicates. for (i = 0; i < Lightbox.imageArray.length; i++) { for (j = Lightbox.imageArray.length-1; j > i; j--) { if (Lightbox.imageArray[i][0] == Lightbox.imageArray[j][0]) { Lightbox.imageArray.splice(j,1); } } } while (Lightbox.imageArray[Lightbox.imageNum][0] != imageLink.href) { Lightbox.imageNum++; } } } if (Lightbox.isSlideshow && Lightbox.showPlayPause && Lightbox.isPaused) { $('#lightshowPlay').show(); $('#lightshowPause').hide(); } // Calculate top and left offset for the lightbox. var arrayPageScroll = Lightbox.getPageScroll(); var lightboxTop = arrayPageScroll[1] + (Lightbox.topPosition == '' ? (arrayPageSize[3] / 10) : Lightbox.topPosition) * 1; var lightboxLeft = arrayPageScroll[0]; $('#frameContainer, #modalContainer, #lightboxImage').hide(); $('#hoverNav, #prevLink, #nextLink, #frameHoverNav, #framePrevLink, #frameNextLink').hide(); $('#imageDataContainer, #numberDisplay, #bottomNavZoom, #bottomNavZoomOut').hide(); $('#outerImageContainer').css({'width': '250px', 'height': '250px'}); $('#lightbox').css({ 'zIndex': '10500', 'top': lightboxTop + 'px', 'left': lightboxLeft + 'px' }).show(); Lightbox.total = Lightbox.imageArray.length; Lightbox.changeData(Lightbox.imageNum); }, // changeData() // Hide most elements and preload image in preparation for resizing image // container. changeData: function(imageNum, zoomIn) { if (Lightbox.inprogress === false) { if (Lightbox.total > 1 && ((Lightbox.isSlideshow && Lightbox.loopSlides) || (!Lightbox.isSlideshow && Lightbox.loopItems))) { if (imageNum >= Lightbox.total) imageNum = 0; if (imageNum < 0) imageNum = Lightbox.total - 1; } if (Lightbox.isSlideshow) { for (var i = 0; i < Lightbox.slideIdCount; i++) { window.clearTimeout(Lightbox.slideIdArray[i]); } } Lightbox.inprogress = true; Lightbox.activeImage = imageNum; if (Lightbox.disableResize && !Lightbox.isSlideshow) { zoomIn = true; } Lightbox.isZoomedIn = zoomIn; // Hide elements during transition. $('#loading').css({'zIndex': '10500'}).show(); if (!Lightbox.alternative_layout) { $('#imageContainer').hide(); } $('#frameContainer, #modalContainer, #lightboxImage').hide(); $('#hoverNav, #prevLink, #nextLink, #frameHoverNav, #framePrevLink, #frameNextLink').hide(); $('#imageDataContainer, #numberDisplay, #bottomNavZoom, #bottomNavZoomOut').hide(); // Preload image content, but not iframe pages. if (!Lightbox.isLightframe && !Lightbox.isVideo && !Lightbox.isModal) { $("#lightbox #imageDataContainer").removeClass('lightbox2-alt-layout-data'); imgPreloader = new Image(); imgPreloader.onerror = function() { Lightbox.imgNodeLoadingError(this); }; imgPreloader.onload = function() { var photo = document.getElementById('lightboxImage'); photo.src = Lightbox.imageArray[Lightbox.activeImage][0]; photo.alt = Lightbox.imageArray[Lightbox.activeImage][2]; var imageWidth = imgPreloader.width; var imageHeight = imgPreloader.height; // Resize code. var arrayPageSize = Lightbox.getPageSize(); var targ = { w:arrayPageSize[2] - (Lightbox.borderSize * 2), h:arrayPageSize[3] - (Lightbox.borderSize * 6) - (Lightbox.infoHeight * 4) - (arrayPageSize[3] / 10) }; var orig = { w:imgPreloader.width, h:imgPreloader.height }; // Image is very large, so show a smaller version of the larger image // with zoom button. if (zoomIn !== true) { var ratio = 1.0; // Shrink image with the same aspect. $('#bottomNavZoomOut, #bottomNavZoom').hide(); if ((orig.w >= targ.w || orig.h >= targ.h) && orig.h && orig.w) { ratio = ((targ.w / orig.w) < (targ.h / orig.h)) ? targ.w / orig.w : targ.h / orig.h; if (!Lightbox.disableZoom && !Lightbox.isSlideshow) { $('#bottomNavZoom').css({'zIndex': '10500'}).show(); } } imageWidth = Math.floor(orig.w * ratio); imageHeight = Math.floor(orig.h * ratio); } else { $('#bottomNavZoom').hide(); // Only display zoom out button if the image is zoomed in already. if ((orig.w >= targ.w || orig.h >= targ.h) && orig.h && orig.w) { // Only display zoom out button if not a slideshow and if the // buttons aren't disabled. if (!Lightbox.disableResize && Lightbox.isSlideshow === false && !Lightbox.disableZoom) { $('#bottomNavZoomOut').css({'zIndex': '10500'}).show(); } } } photo.style.width = (imageWidth) + 'px'; photo.style.height = (imageHeight) + 'px'; Lightbox.resizeContainer(imageWidth, imageHeight); // Clear onLoad, IE behaves irratically with animated gifs otherwise. imgPreloader.onload = function() {}; }; imgPreloader.src = Lightbox.imageArray[Lightbox.activeImage][0]; imgPreloader.alt = Lightbox.imageArray[Lightbox.activeImage][2]; } // Set up frame size, etc. else if (Lightbox.isLightframe) { $("#lightbox #imageDataContainer").addClass('lightbox2-alt-layout-data'); var src = Lightbox.imageArray[Lightbox.activeImage][0]; $('#frameContainer').html('<iframe id="lightboxFrame" style="display: none;" src="'+src+'"></iframe>'); // Enable swf support in Gecko browsers. if ($.browser.mozilla && src.indexOf('.swf') != -1) { setTimeout(function () { document.getElementById("lightboxFrame").src = Lightbox.imageArray[Lightbox.activeImage][0]; }, 1000); } if (!Lightbox.iframe_border) { $('#lightboxFrame').css({'border': 'none'}); $('#lightboxFrame').attr('frameborder', '0'); } var iframe = document.getElementById('lightboxFrame'); var iframeStyles = Lightbox.imageArray[Lightbox.activeImage][3]; iframe = Lightbox.setStyles(iframe, iframeStyles); Lightbox.resizeContainer(parseInt(iframe.width, 10), parseInt(iframe.height, 10)); } else if (Lightbox.isVideo || Lightbox.isModal) { $("#lightbox #imageDataContainer").addClass('lightbox2-alt-layout-data'); var container = document.getElementById('modalContainer'); var modalStyles = Lightbox.imageArray[Lightbox.activeImage][3]; container = Lightbox.setStyles(container, modalStyles); if (Lightbox.isVideo) { Lightbox.modalHeight = parseInt(container.height, 10) - 10; Lightbox.modalWidth = parseInt(container.width, 10) - 10; Lightvideo.startVideo(Lightbox.imageArray[Lightbox.activeImage][0]); } Lightbox.resizeContainer(parseInt(container.width, 10), parseInt(container.height, 10)); } } }, // imgNodeLoadingError() imgNodeLoadingError: function(image) { var s = Drupal.settings.lightbox2; var original_image = Lightbox.imageArray[Lightbox.activeImage][0]; if (s.display_image_size !== "") { original_image = original_image.replace(new RegExp("."+s.display_image_size), ""); } Lightbox.imageArray[Lightbox.activeImage][0] = original_image; image.onerror = function() { Lightbox.imgLoadingError(image); }; image.src = original_image; }, // imgLoadingError() imgLoadingError: function(image) { var s = Drupal.settings.lightbox2; Lightbox.imageArray[Lightbox.activeImage][0] = s.default_image; image.src = s.default_image; }, // resizeContainer() resizeContainer: function(imgWidth, imgHeight) { imgWidth = (imgWidth < Lightbox.minWidth ? Lightbox.minWidth : imgWidth); this.widthCurrent = $('#outerImageContainer').width(); this.heightCurrent = $('#outerImageContainer').height(); var widthNew = (imgWidth + (Lightbox.borderSize * 2)); var heightNew = (imgHeight + (Lightbox.borderSize * 2)); // Scalars based on change from old to new. this.xScale = ( widthNew / this.widthCurrent) * 100; this.yScale = ( heightNew / this.heightCurrent) * 100; // Calculate size difference between new and old image, and resize if // necessary. wDiff = this.widthCurrent - widthNew; hDiff = this.heightCurrent - heightNew; $('#modalContainer').css({'width': imgWidth, 'height': imgHeight}); // Detect animation sequence. if (Lightbox.resizeSequence) { var animate1 = {width: widthNew}; var animate2 = {height: heightNew}; if (Lightbox.resizeSequence == 2) { animate1 = {height: heightNew}; animate2 = {width: widthNew}; } $('#outerImageContainer').animate(animate1, Lightbox.resizeSpeed).animate(animate2, Lightbox.resizeSpeed, 'linear', function() { Lightbox.showData(); }); } // Simultaneous. else { $('#outerImageContainer').animate({'width': widthNew, 'height': heightNew}, Lightbox.resizeSpeed, 'linear', function() { Lightbox.showData(); }); } // If new and old image are same size and no scaling transition is necessary // do a quick pause to prevent image flicker. if ((hDiff === 0) && (wDiff === 0)) { if ($.browser.msie) { Lightbox.pause(250); } else { Lightbox.pause(100); } } var s = Drupal.settings.lightbox2; if (!s.use_alt_layout) { $('#prevLink, #nextLink').css({'height': imgHeight + 'px'}); } $('#imageDataContainer').css({'width': widthNew + 'px'}); }, // showData() // Display image and begin preloading neighbors. showData: function() { $('#loading').hide(); if (Lightbox.isLightframe || Lightbox.isVideo || Lightbox.isModal) { Lightbox.updateDetails(); if (Lightbox.isLightframe) { $('#frameContainer').show(); if ($.browser.safari || Lightbox.fadeInSpeed === 0) { $('#lightboxFrame').css({'zIndex': '10500'}).show(); } else { $('#lightboxFrame').css({'zIndex': '10500'}).fadeIn(Lightbox.fadeInSpeed); } } else { if (Lightbox.isVideo) { $("#modalContainer").html(Lightbox.modalHTML).click(function(){return false;}).css('zIndex', '10500').show(); } else { var src = unescape(Lightbox.imageArray[Lightbox.activeImage][0]); if (Lightbox.imageArray[Lightbox.activeImage][4]) { $(src).appendTo("#modalContainer"); $('#modalContainer').css({'zIndex': '10500'}).show(); } else { // Use a callback to show the new image, otherwise you get flicker. $("#modalContainer").hide().load(src, function () {$('#modalContainer').css({'zIndex': '10500'}).show();}); } $('#modalContainer').unbind('click'); } // This might be needed in the Lightframe section above. //$('#modalContainer').css({'zIndex': '10500'}).show(); } } // Handle display of image content. else { $('#imageContainer').show(); if ($.browser.safari || Lightbox.fadeInSpeed === 0) { $('#lightboxImage').css({'zIndex': '10500'}).show(); } else { $('#lightboxImage').css({'zIndex': '10500'}).fadeIn(Lightbox.fadeInSpeed); } Lightbox.updateDetails(); this.preloadNeighborImages(); } Lightbox.inprogress = false; // Slideshow specific stuff. if (Lightbox.isSlideshow) { if (!Lightbox.loopSlides && Lightbox.activeImage == (Lightbox.total - 1)) { if (Lightbox.autoExit) { Lightbox.slideIdArray[Lightbox.slideIdCount++] = setTimeout(function () {Lightbox.end('slideshow');}, Lightbox.slideInterval); } } else { if (!Lightbox.isPaused && Lightbox.total > 1) { Lightbox.slideIdArray[Lightbox.slideIdCount++] = setTimeout(function () {Lightbox.changeData(Lightbox.activeImage + 1);}, Lightbox.slideInterval); } } if (Lightbox.showPlayPause && Lightbox.total > 1 && !Lightbox.isPaused) { $('#lightshowPause').show(); $('#lightshowPlay').hide(); } else if (Lightbox.showPlayPause && Lightbox.total > 1) { $('#lightshowPause').hide(); $('#lightshowPlay').show(); } } // Adjust the page overlay size. var arrayPageSize = Lightbox.getPageSize(); var arrayPageScroll = Lightbox.getPageScroll(); var pageHeight = arrayPageSize[1]; if (Lightbox.isZoomedIn && arrayPageSize[1] > arrayPageSize[3]) { var lightboxTop = (Lightbox.topPosition == '' ? (arrayPageSize[3] / 10) : Lightbox.topPosition) * 1; pageHeight = pageHeight + arrayPageScroll[1] + lightboxTop; } $('#lightbox2-overlay').css({'height': pageHeight + 'px', 'width': arrayPageSize[0] + 'px'}); // Gecko browsers (e.g. Firefox, SeaMonkey, etc) don't handle pdfs as // expected. if ($.browser.mozilla) { if (Lightbox.imageArray[Lightbox.activeImage][0].indexOf(".pdf") != -1) { setTimeout(function () { document.getElementById("lightboxFrame").src = Lightbox.imageArray[Lightbox.activeImage][0]; }, 1000); } } }, // updateDetails() // Display caption, image number, and bottom nav. updateDetails: function() { $("#imageDataContainer").hide(); var s = Drupal.settings.lightbox2; if (s.show_caption) { var caption = Lightbox.filterXSS(Lightbox.imageArray[Lightbox.activeImage][1]); if (!caption) caption = ''; $('#caption').html(caption).css({'zIndex': '10500'}).show(); } // If image is part of set display 'Image x of x'. var numberDisplay = null; if (s.image_count && Lightbox.total > 1) { var currentImage = Lightbox.activeImage + 1; if (!Lightbox.isLightframe && !Lightbox.isModal && !Lightbox.isVideo) { numberDisplay = s.image_count.replace(/\!current/, currentImage).replace(/\!total/, Lightbox.total); } else if (Lightbox.isVideo) { numberDisplay = s.video_count.replace(/\!current/, currentImage).replace(/\!total/, Lightbox.total); } else { numberDisplay = s.page_count.replace(/\!current/, currentImage).replace(/\!total/, Lightbox.total); } $('#numberDisplay').html(numberDisplay).css({'zIndex': '10500'}).show(); } else { $('#numberDisplay').hide(); } $("#imageDataContainer").hide().slideDown(Lightbox.slideDownSpeed, function() { $("#bottomNav").show(); }); if (Lightbox.rtl == 1) { $("#bottomNav").css({'float': 'left'}); } Lightbox.updateNav(); }, // updateNav() // Display appropriate previous and next hover navigation. updateNav: function() { $('#hoverNav').css({'zIndex': '10500'}).show(); var prevLink = '#prevLink'; var nextLink = '#nextLink'; // Slideshow is separated as we need to show play / pause button. if (Lightbox.isSlideshow) { if ((Lightbox.total > 1 && Lightbox.loopSlides) || Lightbox.activeImage !== 0) { $(prevLink).css({'zIndex': '10500'}).show().click(function() { if (Lightbox.pauseOnPrevClick) { Lightbox.togglePlayPause("lightshowPause", "lightshowPlay"); } Lightbox.changeData(Lightbox.activeImage - 1); return false; }); } else { $(prevLink).hide(); } // If not last image in set, display next image button. if ((Lightbox.total > 1 && Lightbox.loopSlides) || Lightbox.activeImage != (Lightbox.total - 1)) { $(nextLink).css({'zIndex': '10500'}).show().click(function() { if (Lightbox.pauseOnNextClick) { Lightbox.togglePlayPause("lightshowPause", "lightshowPlay"); } Lightbox.changeData(Lightbox.activeImage + 1); return false; }); } // Safari browsers need to have hide() called again. else { $(nextLink).hide(); } } // All other types of content. else { if ((Lightbox.isLightframe || Lightbox.isModal || Lightbox.isVideo) && !Lightbox.alternative_layout) { $('#frameHoverNav').css({'zIndex': '10500'}).show(); $('#hoverNav').css({'zIndex': '10500'}).hide(); prevLink = '#framePrevLink'; nextLink = '#frameNextLink'; } // If not first image in set, display prev image button. if ((Lightbox.total > 1 && Lightbox.loopItems) || Lightbox.activeImage !== 0) { // Unbind any other click handlers, otherwise this adds a new click handler // each time the arrow is clicked. $(prevLink).css({'zIndex': '10500'}).show().unbind().click(function() { Lightbox.changeData(Lightbox.activeImage - 1); return false; }); } // Safari browsers need to have hide() called again. else { $(prevLink).hide(); } // If not last image in set, display next image button. if ((Lightbox.total > 1 && Lightbox.loopItems) || Lightbox.activeImage != (Lightbox.total - 1)) { // Unbind any other click handlers, otherwise this adds a new click handler // each time the arrow is clicked. $(nextLink).css({'zIndex': '10500'}).show().unbind().click(function() { Lightbox.changeData(Lightbox.activeImage + 1); return false; }); } // Safari browsers need to have hide() called again. else { $(nextLink).hide(); } } // Don't enable keyboard shortcuts so forms will work. if (!Lightbox.isModal) { this.enableKeyboardNav(); } }, // enableKeyboardNav() enableKeyboardNav: function() { $(document).bind("keydown", this.keyboardAction); }, // disableKeyboardNav() disableKeyboardNav: function() { $(document).unbind("keydown", this.keyboardAction); }, // keyboardAction() keyboardAction: function(e) { if (e === null) { // IE. keycode = event.keyCode; escapeKey = 27; } else { // Mozilla. keycode = e.keyCode; escapeKey = e.DOM_VK_ESCAPE; } key = String.fromCharCode(keycode).toLowerCase(); // Close lightbox. if (Lightbox.checkKey(Lightbox.keysClose, key, keycode)) { Lightbox.end('forceClose'); } // Display previous image (p, <-). else if (Lightbox.checkKey(Lightbox.keysPrevious, key, keycode)) { if ((Lightbox.total > 1 && ((Lightbox.isSlideshow && Lightbox.loopSlides) || (!Lightbox.isSlideshow && Lightbox.loopItems))) || Lightbox.activeImage !== 0) { Lightbox.changeData(Lightbox.activeImage - 1); } } // Display next image (n, ->). else if (Lightbox.checkKey(Lightbox.keysNext, key, keycode)) { if ((Lightbox.total > 1 && ((Lightbox.isSlideshow && Lightbox.loopSlides) || (!Lightbox.isSlideshow && Lightbox.loopItems))) || Lightbox.activeImage != (Lightbox.total - 1)) { Lightbox.changeData(Lightbox.activeImage + 1); } } // Zoom in. else if (Lightbox.checkKey(Lightbox.keysZoom, key, keycode) && !Lightbox.disableResize && !Lightbox.disableZoom && !Lightbox.isSlideshow && !Lightbox.isLightframe) { if (Lightbox.isZoomedIn) { Lightbox.changeData(Lightbox.activeImage, false); } else if (!Lightbox.isZoomedIn) { Lightbox.changeData(Lightbox.activeImage, true); } return false; } // Toggle play / pause (space). else if (Lightbox.checkKey(Lightbox.keysPlayPause, key, keycode) && Lightbox.isSlideshow) { if (Lightbox.isPaused) { Lightbox.togglePlayPause("lightshowPlay", "lightshowPause"); } else { Lightbox.togglePlayPause("lightshowPause", "lightshowPlay"); } return false; } }, preloadNeighborImages: function() { if ((Lightbox.total - 1) > Lightbox.activeImage) { preloadNextImage = new Image(); preloadNextImage.src = Lightbox.imageArray[Lightbox.activeImage + 1][0]; } if (Lightbox.activeImage > 0) { preloadPrevImage = new Image(); preloadPrevImage.src = Lightbox.imageArray[Lightbox.activeImage - 1][0]; } }, end: function(caller) { var closeClick = (caller == 'slideshow' ? false : true); if (Lightbox.isSlideshow && Lightbox.isPaused && !closeClick) { return; } // To prevent double clicks on navigation links. if (Lightbox.inprogress === true && caller != 'forceClose') { return; } Lightbox.disableKeyboardNav(); $('#lightbox').hide(); $("#lightbox2-overlay").fadeOut(); Lightbox.isPaused = true; Lightbox.inprogress = false; // Replaces calls to showSelectBoxes() and showFlash() in original // lightbox2. Lightbox.toggleSelectsFlash('visible'); if (Lightbox.isSlideshow) { for (var i = 0; i < Lightbox.slideIdCount; i++) { window.clearTimeout(Lightbox.slideIdArray[i]); } $('#lightshowPause, #lightshowPlay').hide(); } else if (Lightbox.isLightframe) { $('#frameContainer').empty().hide(); } else if (Lightbox.isVideo || Lightbox.isModal) { if (!Lightbox.auto_modal) { $('#modalContainer').hide().html(""); } Lightbox.auto_modal = false; } }, // getPageScroll() // Returns array with x,y page scroll values. // Core code from - quirksmode.com. getPageScroll : function() { var xScroll, yScroll; if (self.pageYOffset || self.pageXOffset) { yScroll = self.pageYOffset; xScroll = self.pageXOffset; } else if (document.documentElement && (document.documentElement.scrollTop || document.documentElement.scrollLeft)) { // Explorer 6 Strict. yScroll = document.documentElement.scrollTop; xScroll = document.documentElement.scrollLeft; } else if (document.body) {// All other Explorers. yScroll = document.body.scrollTop; xScroll = document.body.scrollLeft; } arrayPageScroll = [xScroll,yScroll]; return arrayPageScroll; }, // getPageSize() // Returns array with page width, height and window width, height. // Core code from - quirksmode.com. // Edit for Firefox by pHaez. getPageSize : function() { var xScroll, yScroll; if (window.innerHeight && window.scrollMaxY) { xScroll = window.innerWidth + window.scrollMaxX; yScroll = window.innerHeight + window.scrollMaxY; } else if (document.body.scrollHeight > document.body.offsetHeight) { // All but Explorer Mac. xScroll = document.body.scrollWidth; yScroll = document.body.scrollHeight; } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari. xScroll = document.body.offsetWidth; yScroll = document.body.offsetHeight; } var windowWidth, windowHeight; if (self.innerHeight) { // All except Explorer. if (document.documentElement.clientWidth) { windowWidth = document.documentElement.clientWidth; } else { windowWidth = self.innerWidth; } windowHeight = self.innerHeight; } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode. windowWidth = document.documentElement.clientWidth; windowHeight = document.documentElement.clientHeight; } else if (document.body) { // Other Explorers. windowWidth = document.body.clientWidth; windowHeight = document.body.clientHeight; } // For small pages with total height less than height of the viewport. if (yScroll < windowHeight) { pageHeight = windowHeight; } else { pageHeight = yScroll; } // For small pages with total width less than width of the viewport. if (xScroll < windowWidth) { pageWidth = xScroll; } else { pageWidth = windowWidth; } arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight); return arrayPageSize; }, // pause(numberMillis) pause : function(ms) { var date = new Date(); var curDate = null; do { curDate = new Date(); } while (curDate - date < ms); }, // toggleSelectsFlash() // Hide / unhide select lists and flash objects as they appear above the // lightbox in some browsers. toggleSelectsFlash: function (state) { if (state == 'visible') { $("select.lightbox_hidden, embed.lightbox_hidden, object.lightbox_hidden").show(); } else if (state == 'hide') { $("select:visible, embed:visible, object:visible").not('#lightboxAutoModal select, #lightboxAutoModal embed, #lightboxAutoModal object').addClass("lightbox_hidden"); $("select.lightbox_hidden, embed.lightbox_hidden, object.lightbox_hidden").hide(); } }, // parseRel() parseRel: function (link) { var parts = []; parts["rel"] = parts["title"] = parts["group"] = parts["style"] = parts["flashvars"] = null; if (!$(link).attr('rel')) return parts; parts["rel"] = $(link).attr('rel').match(/\w+/)[0]; if ($(link).attr('rel').match(/\[(.*)\]/)) { var info = $(link).attr('rel').match(/\[(.*?)\]/)[1].split('|'); parts["group"] = info[0]; parts["style"] = info[1]; if (parts["style"] != undefined && parts["style"].match(/flashvars:\s?(.*?);/)) { parts["flashvars"] = parts["style"].match(/flashvars:\s?(.*?);/)[1]; } } if ($(link).attr('rel').match(/\[.*\]\[(.*)\]/)) { parts["title"] = $(link).attr('rel').match(/\[.*\]\[(.*)\]/)[1]; } return parts; }, // setStyles() setStyles: function(item, styles) { item.width = Lightbox.iframe_width; item.height = Lightbox.iframe_height; item.scrolling = "auto"; if (!styles) return item; var stylesArray = styles.split(';'); for (var i = 0; i< stylesArray.length; i++) { if (stylesArray[i].indexOf('width:') >= 0) { var w = stylesArray[i].replace('width:', ''); item.width = jQuery.trim(w); } else if (stylesArray[i].indexOf('height:') >= 0) { var h = stylesArray[i].replace('height:', ''); item.height = jQuery.trim(h); } else if (stylesArray[i].indexOf('scrolling:') >= 0) { var scrolling = stylesArray[i].replace('scrolling:', ''); item.scrolling = jQuery.trim(scrolling); } else if (stylesArray[i].indexOf('overflow:') >= 0) { var overflow = stylesArray[i].replace('overflow:', ''); item.overflow = jQuery.trim(overflow); } } return item; }, // togglePlayPause() // Hide the pause / play button as appropriate. If pausing the slideshow also // clear the timers, otherwise move onto the next image. togglePlayPause: function(hideId, showId) { if (Lightbox.isSlideshow && hideId == "lightshowPause") { for (var i = 0; i < Lightbox.slideIdCount; i++) { window.clearTimeout(Lightbox.slideIdArray[i]); } } $('#' + hideId).hide(); $('#' + showId).show(); if (hideId == "lightshowPlay") { Lightbox.isPaused = false; if (!Lightbox.loopSlides && Lightbox.activeImage == (Lightbox.total - 1)) { Lightbox.end(); } else if (Lightbox.total > 1) { Lightbox.changeData(Lightbox.activeImage + 1); } } else { Lightbox.isPaused = true; } }, triggerLightbox: function (rel_type, rel_group) { if (rel_type.length) { if (rel_group && rel_group.length) { $("a[rel^='" + rel_type +"\[" + rel_group + "\]'], area[rel^='" + rel_type +"\[" + rel_group + "\]']").eq(0).trigger("click"); } else { $("a[rel^='" + rel_type +"'], area[rel^='" + rel_type +"']").eq(0).trigger("click"); } } }, detectMacFF2: function() { var ua = navigator.userAgent.toLowerCase(); if (/firefox[\/\s](\d+\.\d+)/.test(ua)) { var ffversion = new Number(RegExp.$1); if (ffversion < 3 && ua.indexOf('mac') != -1) { return true; } } return false; }, checkKey: function(keys, key, code) { return (jQuery.inArray(key, keys) != -1 || jQuery.inArray(String(code), keys) != -1); }, filterXSS: function(str, allowed_tags) { var output = ""; $.ajax({ url: Drupal.settings.basePath + 'system/lightbox2/filter-xss', data: { 'string' : str, 'allowed_tags' : allowed_tags }, type: "POST", async: false, dataType: "json", success: function(data) { output = data; } }); return output; } }; // Initialize the lightbox. Drupal.behaviors.initLightbox = { attach: function(context) { $('body:not(.lightbox-processed)', context).addClass('lightbox-processed').each(function() { Lightbox.initialize(); return false; // Break the each loop. }); // Attach lightbox to any links with lightbox rels. Lightbox.initList(context); $('#lightboxAutoModal', context).triggerHandler('click'); } }; })(jQuery);
JavaScript
/* $Id: lightbox_lite.js,v 1.1.2.2.2.19 2010/06/07 14:54:30 snpower Exp $ */ /** * Lightbox JS: Fullsize Image Overlays * by Lokesh Dhakar - http://www.huddletogether.com * * For more information on this script, visit: * http://huddletogether.com/projects/lightbox/ * * This script is distributed via Drupal.org with permission from Lokesh Dhakar. * Under GPL license. * Mailto: bugzie@gmail.com */ // start jQuery block (function ($) { // // getPageScroll() // Returns array with x,y page scroll values. // Core code from - quirksmode.org // function getPageScroll() { var xScroll, yScroll; if (self.pageYOffset) { yScroll = self.pageYOffset; xScroll = self.pageXOffset; // Explorer 6 Strict } else if (document.documentElement && document.documentElement.scrollTop) { yScroll = document.documentElement.scrollTop; xScroll = document.documentElement.scrollLeft; } else if (document.body) {// all other Explorers yScroll = document.body.scrollTop; xScroll = document.body.scrollLeft; } arrayPageScroll = [xScroll, yScroll]; return arrayPageScroll; } // getPageSize() // Returns array with page width, height and window width, height // Core code from - quirksmode.org // Edit for Firefox by pHaez function getPageSize() { var xScroll, yScroll; if (window.innerHeight && window.scrollMaxY) { xScroll = window.innerWidth + window.scrollMaxX; yScroll = window.innerHeight + window.scrollMaxY; // all but Explorer Mac } else if (document.body.scrollHeight > document.body.offsetHeight) { xScroll = document.body.scrollWidth; yScroll = document.body.scrollHeight; // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari } else { xScroll = document.body.offsetWidth; yScroll = document.body.offsetHeight; } var windowWidth, windowHeight; if (self.innerHeight) { // all except Explorer if (document.documentElement.clientHeight) { windowWidth = document.documentElement.clientWidth; } else { windowWidth = self.innerWidth; } windowHeight = self.innerHeight; } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode windowWidth = document.documentElement.clientWidth; windowHeight = document.documentElement.clientHeight; } else if (document.body) { // other Explorers windowWidth = document.body.clientWidth; windowHeight = document.body.clientHeight; } // for small pages with total height less then height of the viewport if (yScroll < windowHeight) { pageHeight = windowHeight; } else { pageHeight = yScroll; } // for small pages with total width less then width of the viewport if (xScroll < windowWidth) { pageWidth = xScroll; } else { pageWidth = windowWidth; } arrayPageSize = [pageWidth, pageHeight, windowWidth, windowHeight]; return arrayPageSize; } // pause(numberMillis) function pause(ms) { var date = new Date(); var curDate = null; do { curDate = new Date(); } while (curDate - date < ms); } // hideLightbox() function hideLightbox() { // get objects objOverlay = document.getElementById('lightbox2-overlay'); objLightbox = document.getElementById('lightbox'); // hide lightbox and overlay objOverlay.style.display = 'none'; objLightbox.style.display = 'none'; // make select boxes visible selects = document.getElementsByTagName("select"); for (i = 0; i != selects.length; i++) { if (selects[i].style.display != "none") { selects[i].style.visibility = "visible"; } } // make flash objects visible embed = document.getElementsByTagName("embed"); for (i = 0; i != embed.length; i++) { if (embed[i].style.display != "none") { embed[i].style.visibility = "visible"; } } objects = document.getElementsByTagName("object"); for (i = 0; i != objects.length; i++) { if (objects[i].style.display != "none") { objects[i].style.visibility = "visible"; } } // disable keydown listener document.onkeydown = ''; } // getKey(key) // Gets keycode. If 'x' is pressed then it hides the lightbox. function getKey(e) { if (e === null) { // ie keycode = event.keyCode; escapeKey = 27; } else { // mozilla keycode = e.keyCode; escapeKey = e.DOM_VK_ESCAPE; } key = String.fromCharCode(keycode).toLowerCase(); if (key == 'x' || key == 'c' || keycode == escapeKey) { hideLightbox(); } } // listenKey() function listenKey () { document.onkeydown = getKey; } function imgLoadingError(image, objImage, objLink) { var settings = Drupal.settings.lightbox2; image.src = settings.default_image; objImage.src = settings.default_image; objLink.href = settings.default_image; } // showLightbox() // Preloads images. Pleaces new image in lightbox then centers and displays. function showLightbox(objLink) { var settings = Drupal.settings.lightbox2; // prep objects var objOverlay = document.getElementById('lightbox2-overlay'); var objLightbox = document.getElementById('lightbox'); var objCaption = document.getElementById('lightboxCaption'); var objImage = document.getElementById('lightboxImage'); var objLoadingImage = document.getElementById('loadingImage'); var objLightboxDetails = document.getElementById('lightboxDetails'); var arrayPageSize = getPageSize(); var arrayPageScroll = getPageScroll(); // set height of Overlay to take up whole page and show objOverlay.style.height = (arrayPageSize[1] + 'px'); objOverlay.style.display = 'block'; objOverlay.style.opacity = settings.overlay_opacity; objOverlay.style.backgroundColor = '#' + settings.overlay_color; // preload image imgPreload = new Image(); imgPreload.onerror = function() { imgLoadingError(this, objImage, objLink); }; imgPreload.onload = function() { objImage.src = objLink.href; // center lightbox and make sure that the top and left values are not // negative and the image placed outside the viewport var lightboxTop = arrayPageScroll[1] + ((arrayPageSize[3] - 35 - imgPreload.height) / 2); var lightboxLeft = ((arrayPageSize[0] - 20 - imgPreload.width) / 2); objLightbox.style.top = (lightboxTop < 0) ? "0px" : lightboxTop + "px"; objLightbox.style.left = (lightboxLeft < 0) ? "0px" : lightboxLeft + "px"; //objLightboxDetails.style.width = imgPreload.width + 'px'; objLightbox.style.width = imgPreload.width + 'px'; if (objLink.getAttribute('title')) { objCaption.style.display = 'block'; //objCaption.style.width = imgPreload.width + 'px'; objCaption.innerHTML = objLink.getAttribute('title'); } else { objCaption.style.display = 'none'; } // A small pause between the image loading and displaying is required with // IE, this prevents the previous image displaying for a short burst // causing flicker. if (navigator.appVersion.indexOf("MSIE") != -1) { pause(250); } if (objLoadingImage) { objLoadingImage.style.display = 'none'; } // Hide select boxes as they will 'peek' through the image in IE selects = document.getElementsByTagName("select"); for (i = 0; i != selects.length; i++) { if (selects[i].style.display != "none") { selects[i].style.visibility = "hidden"; } } // Hide flash objects as they will 'peek' through the image in IE embed = document.getElementsByTagName("embed"); for (i = 0; i != embed.length; i++) { if (embed[i].style.display != "none") { embed[i].style.visibility = "hidden"; } } objects = document.getElementsByTagName("object"); for (i = 0; i != objects.length; i++) { if (objects[i].style.display != "none") { objects[i].style.visibility = "hidden"; } } objLightbox.style.display = 'block'; // After image is loaded, update the overlay height as the new image might // have increased the overall page height. arrayPageSize = getPageSize(); objOverlay.style.height = (arrayPageSize[1] + 'px'); // Check for 'x' keydown listenKey(); return false; }; imgPreload.src = objLink.href; } // initLightbox() // Function runs on window load, going through link tags looking for // rel="lightbox". These links receive onclick events that enable the lightbox // display for their targets. The function also inserts html markup at the top // of the page which will be used as a container for the overlay pattern and // the inline image. function initLightbox() { if (!document.getElementsByTagName) { return; } var anchors = document.getElementsByTagName("a"); // loop through all anchor tags for (var i = 0; i < anchors.length; i++) { var anchor = anchors[i]; var relAttribute = String(anchor.getAttribute("rel")); if (anchor.getAttribute("href") && relAttribute.toLowerCase().match("lightbox")) { $(anchor).click(function(e) { showLightbox(this); if (e.preventDefault) { e.preventDefault(); } return false; }); } } // the rest of this code inserts html at the top of the page that looks like // this: // <div id="lightbox2-overlay"> // <a href="#" onclick="hideLightbox(); return false;"><img id="loadingImage" /></a> // </div> // <div id="lightbox"> // <a href="#" onclick="hideLightbox(); return false;" title="Click anywhere to close image"> // <img id="closeButton" /> // <img id="lightboxImage" /> // </a> // <div id="lightboxDetails"> // <div id="lightboxCaption"></div> // <div id="keyboardMsg"></div> // </div> // </div> var objBody = document.getElementsByTagName("body").item(0); // create overlay div and hardcode some functional styles (aesthetic styles are in CSS file) var objOverlay = document.createElement("div"); objOverlay.setAttribute('id', 'lightbox2-overlay'); objOverlay.onclick = function () { hideLightbox(); return false; }; objOverlay.style.display = 'none'; objOverlay.style.position = 'absolute'; objOverlay.style.top = '0'; objOverlay.style.left = '0'; objOverlay.style.zIndex = '90'; objOverlay.style.width = '100%'; objBody.insertBefore(objOverlay, objBody.firstChild); var arrayPageSize = getPageSize(); var arrayPageScroll = getPageScroll(); // create loader image var objLoadingImage = document.createElement("span"); objLoadingImage.setAttribute('id', 'loadingImage'); objOverlay.appendChild(objLoadingImage); // create lightbox div, same note about styles as above var objLightbox = document.createElement("div"); objLightbox.setAttribute('id', 'lightbox'); objLightbox.style.display = 'none'; objLightbox.style.position = 'absolute'; objLightbox.style.zIndex = '100'; objBody.insertBefore(objLightbox, objOverlay.nextSibling); // create link var objLink = document.createElement("a"); objLink.setAttribute('href', '#'); objLink.setAttribute('title', 'Click to close'); objLink.onclick = function () { hideLightbox(); return false; }; objLightbox.appendChild(objLink); // create close button image var objCloseButton = document.createElement("span"); objCloseButton.setAttribute('id', 'closeButton'); objLink.appendChild(objCloseButton); // create image var objImage = document.createElement("img"); objImage.setAttribute('id', 'lightboxImage'); objLink.appendChild(objImage); // create details div, a container for the caption and keyboard message var objLightboxDetails = document.createElement("div"); objLightboxDetails.setAttribute('id', 'lightboxDetails'); objLightbox.appendChild(objLightboxDetails); // create caption var objCaption = document.createElement("div"); objCaption.setAttribute('id', 'lightboxCaption'); objCaption.style.display = 'none'; objLightboxDetails.appendChild(objCaption); // create keyboard message var settings = Drupal.settings.lightbox2; var objKeyboardMsg = document.createElement("div"); objKeyboardMsg.setAttribute('id', 'keyboardMsg'); objKeyboardMsg.innerHTML = settings.lite_press_x_close; objLightboxDetails.appendChild(objKeyboardMsg); } Drupal.behaviors.initLightbox2 = { attach: function(context) { initLightbox(); } }; //End jQuery block }(jQuery));
JavaScript
// script.aculo.us scriptaculous.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008 // Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // // For details, see the script.aculo.us web site: http://script.aculo.us/ var Scriptaculous = { Version: '1.8.1', require: function(libraryName) { // inserting via DOM fails in Safari 2.0, so brute force approach document.write('<script type="text/javascript" src="'+libraryName+'"><\/script>'); }, REQUIRED_PROTOTYPE: '1.6.0', load: function() { function convertVersionString(versionString){ var r = versionString.split('.'); return parseInt(r[0])*100000 + parseInt(r[1])*1000 + parseInt(r[2]); } if((typeof Prototype=='undefined') || (typeof Element == 'undefined') || (typeof Element.Methods=='undefined') || (convertVersionString(Prototype.Version) < convertVersionString(Scriptaculous.REQUIRED_PROTOTYPE))) throw("script.aculo.us requires the Prototype JavaScript framework >= " + Scriptaculous.REQUIRED_PROTOTYPE); $A(document.getElementsByTagName("script")).findAll( function(s) { return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/)) }).each( function(s) { var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,''); var includes = s.src.match(/\?.*load=([a-z,]*)/); (includes ? includes[1] : 'builder,effects').split(',').each( function(include) { Scriptaculous.require(path+include+'.js') }); }); } } Scriptaculous.load();
JavaScript
(function ($) { function lightbox2_login() { $("a[href*='/user/login'], a[href*='?q=user/login']").each(function() { $(this).attr({ href: this.href.replace(/user\/login?/,"user/login/lightbox2"), rel: 'lightmodal[|width:250px; height:210px;]' }); $(this).addClass('lightmodal-login'); }); } function lightbox2_contact() { $("a[href$='/contact'], a[href$='?q=contact']").each(function() { if (!this.href.match('admin/build/contact')) { $(this).attr({ href: this.href.replace(/contact?/,"contact/lightbox2"), rel: 'lightmodal[|width:450px; height:450px;]' }); $(this).addClass('lightmodal-contact'); } }); } Drupal.behaviors.initLightboxModal = { attach: function(context, settings) { if (settings.lightbox2.enable_login) { lightbox2_login(); } if (settings.lightbox2.enable_contact) { lightbox2_contact(); } } }; //End jQuery block }(jQuery));
JavaScript
/* $Id: lightbox_video.js,v 1.1.4.20 2010/09/21 17:57:22 snpower Exp $ */ /** * Lightbox video * @author * Stella Power, <http://drupal.org/user/66894> */ var Lightvideo; // start jQuery block (function ($) { Lightvideo = { // startVideo() startVideo: function (href) { if (Lightvideo.checkKnownVideos(href)) { return; } else if (href.match(/\.mov$/i)) { if (navigator.plugins && navigator.plugins.length) { Lightbox.modalHTML ='<object id="qtboxMovie" type="video/quicktime" codebase="http://www.apple.com/qtactivex/qtplugin.cab" data="'+href+'" width="'+Lightbox.modalWidth+'" height="'+Lightbox.modalHeight+'"><param name="allowFullScreen" value="true"></param><param name="src" value="'+href+'" /><param name="scale" value="aspect" /><param name="controller" value="true" /><param name="autoplay" value="true" /><param name="bgcolor" value="#000000" /><param name="enablejavascript" value="true" /></object>'; } else { Lightbox.modalHTML = '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" width="'+Lightbox.modalWidth+'" height="'+Lightbox.modalHeight+'" id="qtboxMovie"><param name="allowFullScreen" value="true"></param><param name="src" value="'+href+'" /><param name="scale" value="aspect" /><param name="controller" value="true" /><param name="autoplay" value="true" /><param name="bgcolor" value="#000000" /><param name="enablejavascript" value="true" /></object>'; } } else if (href.match(/\.wmv$/i) || href.match(/\.asx$/i)) { Lightbox.modalHTML = '<object NAME="Player" WIDTH="'+Lightbox.modalWidth+'" HEIGHT="'+Lightbox.modalHeight+'" align="left" hspace="0" type="application/x-oleobject" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"><param name="allowFullScreen" value="true"></param><param NAME="URL" VALUE="'+href+'"></param><param NAME="AUTOSTART" VALUE="true"></param><param name="showControls" value="true"></param><embed WIDTH="'+Lightbox.modalWidth+'" HEIGHT="'+Lightbox.modalHeight+'" align="left" hspace="0" SRC="'+href+'" TYPE="application/x-oleobject" AUTOSTART="false"></embed></object>'; } else { Lightbox.videoId = href; variables = ''; if (!href.match(/\.swf$/i)) { href = Lightbox.flvPlayer + '?file=' + href; if (Lightbox.flvFlashvars.length) { variables = Lightbox.flvFlashvars; } } Lightvideo.createEmbed(href, "flvplayer", "#ffffff", variables); } }, // createEmbed() createEmbed: function(href, id, color, variables) { var bgcolor = 'bgcolor="' + color + '"'; var flashvars = ''; if (variables) { flashvars = 'flashvars="' + variables + '"'; } Lightbox.modalHTML = '<embed type="application/x-shockwave-flash" ' + 'src="' + href + '" ' + 'id="' + id + '" name="' + id + '" ' + bgcolor + ' ' + 'quality="high" wmode="transparent" ' + flashvars + ' ' + 'height="' + Lightbox.modalHeight + '" ' + 'width="' + Lightbox.modalWidth + '" ' + 'allowfullscreen="true" ' + '></embed>'; }, // checkKnownVideos() checkKnownVideos: function(href) { if (Lightvideo.checkYouTubeVideo(href) || Lightvideo.checkGoogleVideo(href) || Lightvideo.checkMySpaceVideo(href) || Lightvideo.checkLiveVideo(href) || Lightvideo.checkMetacafeVideo(href) || Lightvideo.checkIFilmSpikeVideo(href) ) { return true; } return false; }, // checkYouTubeVideo() checkYouTubeVideo: function(href) { var patterns = [ 'youtube.com/v/([^"&]+)', 'youtube.com/watch\\?v=([^"&]+)', 'youtube.com/\\?v=([^"&]+)' ]; for (var i = 0; i < patterns.length; i++) { var pattern = new RegExp(patterns[i], "i"); var results = pattern.exec(href); if (results !== null) { Lightbox.videoId = results[1]; var href = "http://www.youtube.com/v/"+Lightbox.videoId; var variables = 'fs=1'; if (Lightbox.flvFlashvars.length) { variables = variables + '&' + Lightbox.flvFlashvars; href = href + '&' + variables; } Lightvideo.createEmbed(href, "flvvideo", "#ffffff", variables); return true; } } return false; }, // checkGoogleVideo() checkGoogleVideo: function(href) { var patterns = [ 'http://video.google.[a-z]{2,4}/googleplayer.swf\\?docId=(-?\\d*)', 'http://video.google.[a-z]{2,4}/videoplay\\?docid=([^&]*)&', 'http://video.google.[a-z]{2,4}/videoplay\\?docid=(.*)' ]; for (var i = 0; i < patterns.length; i++) { var pattern = new RegExp(patterns[i], "i"); var results = pattern.exec(href); if (results !== null) { Lightbox.videoId = results[1]; var href = "http://video.google.com/googleplayer.swf?docId="+Lightbox.videoId+"&hl=en"; var variables = 'fs=true'; if (Lightbox.flvFlashvars.length) { variables = variables + '&' + Lightbox.flvFlashvars; href = href + '&' + variables; } Lightvideo.createEmbed(href, "flvvideo", "#ffffff", variables); return true; } } return false; }, // checkMetacafeVideo() checkMetacafeVideo: function(href) { var patterns = [ 'metacafe.com/watch/(\.[^/]*)/(\.[^/]*)/', 'metacafe.com/watch/(\.[^/]*)/(\.*)', 'metacafe.com/fplayer/(\.[^/]*)/(\.[^.]*).' ]; for (var i = 0; i < patterns.length; i++) { var pattern = new RegExp(patterns[i], "i"); var results = pattern.exec(href); if (results !== null) { Lightbox.videoId = results[1]; Lightvideo.createEmbed("http://www.metacafe.com/fplayer/"+Lightbox.videoId+"/.swf", "flvvideo", "#ffffff"); return true; } } return false; }, // checkIFilmSpikeVideo() checkIFilmSpikeVideo: function(href) { var patterns = [ 'spike.com/video/[^/&"]*?/(\\d+)', 'ifilm.com/video/[^/&"]*?/(\\d+)', 'spike.com/video/([^/&"]*)', 'ifilm.com/video/([^/&"]*)' ]; for (var i = 0; i < patterns.length; i++) { var pattern = new RegExp(patterns[i], "i"); var results = pattern.exec(href); if (results !== null) { Lightbox.videoId = results[1]; Lightvideo.createEmbed("http://www.spike.com/efp", "flvvideo", "#000", "flvbaseclip="+Lightbox.videoId+"&amp;"); return true; } } return false; }, // checkMySpaceVideo() checkMySpaceVideo: function(href) { var patterns = [ 'src="myspace.com/index.cfm\\?fuseaction=vids.individual&videoid=([^&"]+)', 'myspace.com/index.cfm\\?fuseaction=vids.individual&videoid=([^&"]+)', 'src="myspacetv.com/index.cfm\\?fuseaction=vids.individual&videoid=([^&"]+)"', 'myspacetv.com/index.cfm\\?fuseaction=vids.individual&videoid=([^&"]+)' ]; for (var i = 0; i < patterns.length; i++) { var pattern = new RegExp(patterns[i], "i"); var results = pattern.exec(href); if (results !== null) { Lightbox.videoId = results[1]; Lightvideo.createEmbed("http://lads.myspace.com/videos/vplayer.swf", "flvvideo", "#ffffff", "m="+Lightbox.videoId); return true; } } return false; }, // checkLiveVideo() checkLiveVideo: function(href) { var patterns = [ 'livevideo.com/flvplayer/embed/([^"]*)"', 'livevideo.com/video/[^/]*?/([^/]*)/', 'livevideo.com/video/([^/]*)/' ]; for (var i = 0; i < patterns.length; i++) { var pattern = new RegExp(patterns[i], "i"); var results = pattern.exec(href); if (results !== null) { Lightbox.videoId = results[1]; Lightvideo.createEmbed("http://www.livevideo.com/flvplayer/embed/"+Lightbox.videoId, "flvvideo", "#ffffff"); return true; } } return false; } }; //End jQuery block }(jQuery));
JavaScript
// script.aculo.us builder.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008 // Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) // // script.aculo.us is freely distributable under the terms of an MIT-style license. // For details, see the script.aculo.us web site: http://script.aculo.us/ var Builder = { NODEMAP: { AREA: 'map', CAPTION: 'table', COL: 'table', COLGROUP: 'table', LEGEND: 'fieldset', OPTGROUP: 'select', OPTION: 'select', PARAM: 'object', TBODY: 'table', TD: 'table', TFOOT: 'table', TH: 'table', THEAD: 'table', TR: 'table' }, // note: For Firefox < 1.5, OPTION and OPTGROUP tags are currently broken, // due to a Firefox bug node: function(elementName) { elementName = elementName.toUpperCase(); // try innerHTML approach var parentTag = this.NODEMAP[elementName] || 'div'; var parentElement = document.createElement(parentTag); try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707 parentElement.innerHTML = "<" + elementName + "></" + elementName + ">"; } catch(e) {} var element = parentElement.firstChild || null; // see if browser added wrapping tags if(element && (element.tagName.toUpperCase() != elementName)) element = element.getElementsByTagName(elementName)[0]; // fallback to createElement approach if(!element) element = document.createElement(elementName); // abort if nothing could be created if(!element) return; // attributes (or text) if(arguments[1]) if(this._isStringOrNumber(arguments[1]) || (arguments[1] instanceof Array) || arguments[1].tagName) { this._children(element, arguments[1]); } else { var attrs = this._attributes(arguments[1]); if(attrs.length) { try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707 parentElement.innerHTML = "<" +elementName + " " + attrs + "></" + elementName + ">"; } catch(e) {} element = parentElement.firstChild || null; // workaround firefox 1.0.X bug if(!element) { element = document.createElement(elementName); for(attr in arguments[1]) element[attr == 'class' ? 'className' : attr] = arguments[1][attr]; } if(element.tagName.toUpperCase() != elementName) element = parentElement.getElementsByTagName(elementName)[0]; } } // text, or array of children if(arguments[2]) this._children(element, arguments[2]); return element; }, _text: function(text) { return document.createTextNode(text); }, ATTR_MAP: { 'className': 'class', 'htmlFor': 'for' }, _attributes: function(attributes) { var attrs = []; for(attribute in attributes) attrs.push((attribute in this.ATTR_MAP ? this.ATTR_MAP[attribute] : attribute) + '="' + attributes[attribute].toString().escapeHTML().gsub(/"/,'&quot;') + '"'); return attrs.join(" "); }, _children: function(element, children) { if(children.tagName) { element.appendChild(children); return; } if(typeof children=='object') { // array can hold nodes and text children.flatten().each( function(e) { if(typeof e=='object') element.appendChild(e) else if(Builder._isStringOrNumber(e)) element.appendChild(Builder._text(e)); }); } else if(Builder._isStringOrNumber(children)) element.appendChild(Builder._text(children)); }, _isStringOrNumber: function(param) { return(typeof param=='string' || typeof param=='number'); }, build: function(html) { var element = this.node('div'); $(element).update(html.strip()); return element.down(); }, dump: function(scope) { if(typeof scope != 'object' && typeof scope != 'function') scope = window; //global scope var tags = ("A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY " + "BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET " + "FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX "+ "KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P "+ "PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD "+ "TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR").split(/\s+/); tags.each( function(tag){ scope[tag] = function() { return Builder.node.apply(Builder, [tag].concat($A(arguments))); } }); } }
JavaScript
(function ($) { $(document).ready(function() { // Expression to check for absolute internal links. var isInternal = new RegExp("^(https?):\/\/" + window.location.host, "i"); // Attach onclick event to document only and catch clicks on all elements. $(document.body).click(function(event) { // Catch the closest surrounding link of a clicked element. $(event.target).closest("a,area").each(function() { var ga = Drupal.settings.googleanalytics; // Expression to check for special links like gotwo.module /go/* links. var isInternalSpecial = new RegExp("(\/go\/.*)$", "i"); // Expression to check for download links. var isDownload = new RegExp("\\.(" + ga.trackDownloadExtensions + ")$", "i"); // Is the clicked URL internal? if (isInternal.test(this.href)) { // Skip 'click' tracking, if custom tracking events are bound. if ($(this).is('.colorbox')) { // Do nothing here. The custom event will handle all tracking. } // Is download tracking activated and the file extension configured for download tracking? else if (ga.trackDownload && isDownload.test(this.href)) { // Download link clicked. var extension = isDownload.exec(this.href); _gaq.push(["_trackEvent", "Downloads", extension[1].toUpperCase(), this.href.replace(isInternal, '')]); } else if (isInternalSpecial.test(this.href)) { // Keep the internal URL for Google Analytics website overlay intact. _gaq.push(["_trackPageview", this.href.replace(isInternal, '')]); } } else { if (ga.trackMailto && $(this).is("a[href^='mailto:'],area[href^='mailto:']")) { // Mailto link clicked. _gaq.push(["_trackEvent", "Mails", "Click", this.href.substring(7)]); } else if (ga.trackOutbound && this.href.match(/^\w+:\/\//i)) { if (ga.trackDomainMode == 2 && isCrossDomain($(this).attr('hostname'), ga.trackCrossDomains)) { // Top-level cross domain clicked. document.location is handled by _link internally. event.preventDefault(); _gaq.push(["_link", this.href]); } else { // External link clicked. _gaq.push(["_trackEvent", "Outbound links", "Click", this.href]); } } } }); }); // Colorbox: This event triggers when the transition has completed and the // newly loaded content has been revealed. $(document).bind("cbox_complete", function() { var href = $.colorbox.element().attr("href"); if (href) { _gaq.push(["_trackPageview", href.replace(isInternal, '')]); } }); }); /** * Check whether the hostname is part of the cross domains or not. * * @param string hostname * The hostname of the clicked URL. * @param array crossDomains * All cross domain hostnames as JS array. * * @return boolean */ function isCrossDomain(hostname, crossDomains) { /** * jQuery < 1.6.3 bug: $.inArray crushes IE6 and Chrome if second argument is * `null` or `undefined`, http://bugs.jquery.com/ticket/10076, * https://github.com/jquery/jquery/commit/a839af034db2bd934e4d4fa6758a3fed8de74174 * * @todo: Remove/Refactor in D8 */ if (!crossDomains) { return false; } else { return $.inArray(hostname, crossDomains) > -1 ? true : false; } } })(jQuery);
JavaScript
(function ($) { /** * Provide the summary information for the tracking settings vertical tabs. */ Drupal.behaviors.trackingSettingsSummary = { attach: function (context) { // Make sure this behavior is processed only if drupalSetSummary is defined. if (typeof jQuery.fn.drupalSetSummary == 'undefined') { return; } $('fieldset#edit-page-vis-settings', context).drupalSetSummary(function (context) { var $radio = $('input[name="googleanalytics_visibility_pages"]:checked', context); if ($radio.val() == 0) { if (!$('textarea[name="googleanalytics_pages"]', context).val()) { return Drupal.t('Not restricted'); } else { return Drupal.t('All pages with exceptions'); } } else { return Drupal.t('Restricted to certain pages'); } }); $('fieldset#edit-role-vis-settings', context).drupalSetSummary(function (context) { var vals = []; $('input[type="checkbox"]:checked', context).each(function () { vals.push($.trim($(this).next('label').text())); }); if (!vals.length) { return Drupal.t('Not restricted'); } else if ($('input[name="googleanalytics_visibility_roles"]:checked', context).val() == 1) { return Drupal.t('Excepted: @roles', {'@roles' : vals.join(', ')}); } else { return vals.join(', '); } }); $('fieldset#edit-user-vis-settings', context).drupalSetSummary(function (context) { var $radio = $('input[name="googleanalytics_custom"]:checked', context); if ($radio.val() == 0) { return Drupal.t('Not customizable'); } else if ($radio.val() == 1) { return Drupal.t('On by default with opt out'); } else { return Drupal.t('Off by default with opt in'); } }); $('fieldset#edit-linktracking', context).drupalSetSummary(function (context) { var vals = []; if ($('input#edit-googleanalytics-trackoutbound', context).is(':checked')) { vals.push(Drupal.t('Outbound links')); } if ($('input#edit-googleanalytics-trackmailto', context).is(':checked')) { vals.push(Drupal.t('Mailto links')); } if ($('input#edit-googleanalytics-trackfiles', context).is(':checked')) { vals.push(Drupal.t('Downloads')); } if (!vals.length) { return Drupal.t('Not tracked'); } return Drupal.t('@items enabled', {'@items' : vals.join(', ')}); }); $('fieldset#edit-messagetracking', context).drupalSetSummary(function (context) { var vals = []; $('input[type="checkbox"]:checked', context).each(function () { vals.push($.trim($(this).next('label').text())); }); if (!vals.length) { return Drupal.t('Not tracked'); } return Drupal.t('@items enabled', {'@items' : vals.join(', ')}); }); $('fieldset#edit-search-and-advertising', context).drupalSetSummary(function (context) { var vals = []; if ($('input#edit-googleanalytics-site-search', context).is(':checked')) { vals.push(Drupal.t('Site search')); } if ($('input#edit-googleanalytics-trackadsense', context).is(':checked')) { vals.push(Drupal.t('AdSense ads')); } if ($('input#edit-googleanalytics-trackdoubleclick', context).is(':checked')) { vals.push(Drupal.t('DoubleClick data')); } if (!vals.length) { return Drupal.t('Not tracked'); } return Drupal.t('@items enabled', {'@items' : vals.join(', ')}); }); $('fieldset#edit-domain-tracking', context).drupalSetSummary(function (context) { var $radio = $('input[name="googleanalytics_domain_mode"]:checked', context); if ($radio.val() == 0) { return Drupal.t('A single domain'); } else if ($radio.val() == 1) { return Drupal.t('One domain with multiple subdomains'); } else { return Drupal.t('Multiple top-level domains'); } }); $('fieldset#edit-privacy', context).drupalSetSummary(function (context) { var vals = []; if ($('input#edit-googleanalytics-tracker-anonymizeip', context).is(':checked')) { vals.push(Drupal.t('Anonymize IP')); } if ($('input#edit-googleanalytics-privacy-donottrack', context).is(':checked')) { vals.push(Drupal.t('Universal web tracking opt-out')); } if (!vals.length) { return Drupal.t('No privacy'); } return Drupal.t('@items enabled', {'@items' : vals.join(', ')}); }); } }; })(jQuery);
JavaScript
/** * This is part of a patch to address a jQueryUI bug. The bug is responsible * for the inability to scroll a page when a modal dialog is active. If the content * of the dialog extends beyond the bottom of the viewport, the user is only able * to scroll with a mousewheel or up/down keyboard keys. * * @see http://bugs.jqueryui.com/ticket/4671 * @see https://bugs.webkit.org/show_bug.cgi?id=19033 * @see views_ui.module * @see js/jquery.ui.dialog.min.js * * This javascript patch overwrites the $.ui.dialog.overlay.events object to remove * the mousedown, mouseup and click events from the list of events that are bound * in $.ui.dialog.overlay.create * * The original code for this object: * $.ui.dialog.overlay.events: $.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','), * function(event) { return event + '.dialog-overlay'; }).join(' '), * */ (function ($, undefined) { if ($.ui && $.ui.dialog) { $.ui.dialog.overlay.events = $.map('focus,keydown,keypress'.split(','), function(event) { return event + '.dialog-overlay'; }).join(' '); } }(jQuery));
JavaScript
/** * @file * Some basic behaviors and utility functions for Views UI. */ Drupal.viewsUi = {}; Drupal.behaviors.viewsUiEditView = {}; /** * Improve the user experience of the views edit interface. */ Drupal.behaviors.viewsUiEditView.attach = function (context, settings) { // Only show the SQL rewrite warning when the user has chosen the // corresponding checkbox. jQuery('#edit-query-options-disable-sql-rewrite').click(function () { jQuery('.sql-rewrite-warning').toggleClass('js-hide'); }); }; Drupal.behaviors.viewsUiAddView = {}; /** * In the add view wizard, use the view name to prepopulate form fields such as * page title and menu link. */ Drupal.behaviors.viewsUiAddView.attach = function (context, settings) { var $ = jQuery; var exclude, replace, suffix; // Set up regular expressions to allow only numbers, letters, and dashes. exclude = new RegExp('[^a-z0-9\\-]+', 'g'); replace = '-'; // The page title, block title, and menu link fields can all be prepopulated // with the view name - no regular expression needed. var $fields = $(context).find('[id^="edit-page-title"], [id^="edit-block-title"], [id^="edit-page-link-properties-title"]'); if ($fields.length) { if (!this.fieldsFiller) { this.fieldsFiller = new Drupal.viewsUi.FormFieldFiller($fields); } else { // After an AJAX response, this.fieldsFiller will still have event // handlers bound to the old version of the form fields (which don't exist // anymore). The event handlers need to be unbound and then rebound to the // new markup. Note that jQuery.live is difficult to make work in this // case because the IDs of the form fields change on every AJAX response. this.fieldsFiller.rebind($fields); } } // Prepopulate the path field with a URLified version of the view name. var $pathField = $(context).find('[id^="edit-page-path"]'); if ($pathField.length) { if (!this.pathFiller) { this.pathFiller = new Drupal.viewsUi.FormFieldFiller($pathField, exclude, replace); } else { this.pathFiller.rebind($pathField); } } // Populate the RSS feed field with a URLified version of the view name, and // an .xml suffix (to make it unique). var $feedField = $(context).find('[id^="edit-page-feed-properties-path"]'); if ($feedField.length) { if (!this.feedFiller) { suffix = '.xml'; this.feedFiller = new Drupal.viewsUi.FormFieldFiller($feedField, exclude, replace, suffix); } else { this.feedFiller.rebind($feedField); } } }; /** * Constructor for the Drupal.viewsUi.FormFieldFiller object. * * Prepopulates a form field based on the view name. * * @param $target * A jQuery object representing the form field to prepopulate. * @param exclude * Optional. A regular expression representing characters to exclude from the * target field. * @param replace * Optional. A string to use as the replacement value for disallowed * characters. * @param suffix * Optional. A suffix to append at the end of the target field content. */ Drupal.viewsUi.FormFieldFiller = function ($target, exclude, replace, suffix) { var $ = jQuery; this.source = $('#edit-human-name'); this.target = $target; this.exclude = exclude || false; this.replace = replace || ''; this.suffix = suffix || ''; // Create bound versions of this instance's object methods to use as event // handlers. This will let us easily unbind those specific handlers later on. // NOTE: jQuery.proxy will not work for this because it assumes we want only // one bound version of an object method, whereas we need one version per // object instance. var self = this; this.populate = function () {return self._populate.call(self);}; this.unbind = function () {return self._unbind.call(self);}; this.bind(); // Object constructor; no return value. }; /** * Bind the form-filling behavior. */ Drupal.viewsUi.FormFieldFiller.prototype.bind = function () { this.unbind(); // Populate the form field when the source changes. this.source.bind('keyup.viewsUi change.viewsUi', this.populate); // Quit populating the field as soon as it gets focus. this.target.bind('focus.viewsUi', this.unbind); }; /** * Get the source form field value as altered by the passed-in parameters. */ Drupal.viewsUi.FormFieldFiller.prototype.getTransliterated = function () { var from = this.source.val(); if (this.exclude) { from = from.toLowerCase().replace(this.exclude, this.replace); } return from + this.suffix; }; /** * Populate the target form field with the altered source field value. */ Drupal.viewsUi.FormFieldFiller.prototype._populate = function () { var transliterated = this.getTransliterated(); this.target.val(transliterated); }; /** * Stop prepopulating the form fields. */ Drupal.viewsUi.FormFieldFiller.prototype._unbind = function () { this.source.unbind('keyup.viewsUi change.viewsUi', this.populate); this.target.unbind('focus.viewsUi', this.unbind); }; /** * Bind event handlers to the new form fields, after they're replaced via AJAX. */ Drupal.viewsUi.FormFieldFiller.prototype.rebind = function ($fields) { this.target = $fields; this.bind(); } Drupal.behaviors.addItemForm = {}; Drupal.behaviors.addItemForm.attach = function (context) { var $ = jQuery; // The add item form may have an id of views-ui-add-item-form--n. var $form = $(context).find('form[id^="views-ui-add-item-form"]').first(); // Make sure we don't add more than one event handler to the same form. $form = $form.once('views-ui-add-item-form'); if ($form.length) { new Drupal.viewsUi.addItemForm($form); } } Drupal.viewsUi.addItemForm = function($form) { this.$form = $form; this.$form.find('.views-filterable-options :checkbox').click(jQuery.proxy(this.handleCheck, this)); // Find the wrapper of the displayed text. this.$selected_div = this.$form.find('.views-selected-options').parent(); this.$selected_div.hide(); this.checkedItems = []; } Drupal.viewsUi.addItemForm.prototype.handleCheck = function (event) { var $target = jQuery(event.target); var label = jQuery.trim($target.next().text()); // Add/remove the checked item to the list. if ($target.is(':checked')) { this.$selected_div.show(); this.checkedItems.push(label); } else { var length = this.checkedItems.length; var position = jQuery.inArray(label, this.checkedItems); // Delete the item from the list and take sure that the list doesn't have undefined items left. for (var i = 0; i < this.checkedItems.length; i++) { if (i == position) { this.checkedItems.splice(i, 1); i--; break; } } // Hide it again if none item is selected. if (this.checkedItems.length == 0) { this.$selected_div.hide(); } } this.refreshCheckedItems(); } /** * Refresh the display of the checked items. */ Drupal.viewsUi.addItemForm.prototype.refreshCheckedItems = function() { // Perhaps we should precache the text div, too. this.$selected_div.find('.views-selected-options').html(this.checkedItems.join(', ')); Drupal.viewsUi.resizeModal('', true); } /** * The input field items that add displays must be rendered as <input> elements. * The following behavior detaches the <input> elements from the DOM, wraps them * in an unordered list, then appends them to the list of tabs. */ Drupal.behaviors.viewsUiRenderAddViewButton = {}; Drupal.behaviors.viewsUiRenderAddViewButton.attach = function (context, settings) { var $ = jQuery; // Build the add display menu and pull the display input buttons into it. var $menu = $('#views-display-menu-tabs', context).once('views-ui-render-add-view-button-processed'); if (!$menu.length) { return; } var $addDisplayDropdown = $('<li class="add"><a href="#"><span class="icon add"></span>' + Drupal.t('Add') + '</a><ul class="action-list" style="display:none;"></ul></li>'); var $displayButtons = $menu.nextAll('input.add-display').detach(); $displayButtons.appendTo($addDisplayDropdown.find('.action-list')).wrap('<li>') .parent().first().addClass('first').end().last().addClass('last'); // Remove the 'Add ' prefix from the button labels since they're being palced // in an 'Add' dropdown. // @todo This assumes English, but so does $addDisplayDropdown above. Add // support for translation. $displayButtons.each(function () { var label = $(this).val(); if (label.substr(0, 4) == 'Add ') { $(this).val(label.substr(4)); } }); $addDisplayDropdown.appendTo($menu); // Add the click handler for the add display button $('li.add > a', $menu).bind('click', function (event) { event.preventDefault(); var $trigger = $(this); Drupal.behaviors.viewsUiRenderAddViewButton.toggleMenu($trigger); }); // Add a mouseleave handler to close the dropdown when the user mouses // away from the item. We use mouseleave instead of mouseout because // the user is going to trigger mouseout when she moves from the trigger // link to the sub menu items. // We use the live binder because the open class on this item will be // toggled on and off and we want the handler to take effect in the cases // that the class is present, but not when it isn't. $('li.add', $menu).live('mouseleave', function (event) { var $this = $(this); var $trigger = $this.children('a[href="#"]'); if ($this.children('.action-list').is(':visible')) { Drupal.behaviors.viewsUiRenderAddViewButton.toggleMenu($trigger); } }); }; /** * @note [@jessebeach] I feel like the following should be a more generic function and * not written specifically for this UI, but I'm not sure where to put it. */ Drupal.behaviors.viewsUiRenderAddViewButton.toggleMenu = function ($trigger) { $trigger.parent().toggleClass('open'); $trigger.next().slideToggle('fast'); } Drupal.behaviors.viewsUiSearchOptions = {}; Drupal.behaviors.viewsUiSearchOptions.attach = function (context) { var $ = jQuery; // The add item form may have an id of views-ui-add-item-form--n. var $form = $(context).find('form[id^="views-ui-add-item-form"]').first(); // Make sure we don't add more than one event handler to the same form. $form = $form.once('views-ui-filter-options'); if ($form.length) { new Drupal.viewsUi.OptionsSearch($form); } }; /** * Constructor for the viewsUi.OptionsSearch object. * * The OptionsSearch object filters the available options on a form according * to the user's search term. Typing in "taxonomy" will show only those options * containing "taxonomy" in their label. */ Drupal.viewsUi.OptionsSearch = function ($form) { this.$form = $form; // Add a keyup handler to the search box. this.$searchBox = this.$form.find('#edit-options-search'); this.$searchBox.keyup(jQuery.proxy(this.handleKeyup, this)); // Get a list of option labels and their corresponding divs and maintain it // in memory, so we have as little overhead as possible at keyup time. this.options = this.getOptions(this.$form.find('.filterable-option')); // Restripe on initial loading. this.handleKeyup(); // Trap the ENTER key in the search box so that it doesn't submit the form. this.$searchBox.keypress(function(event) { if (event.which == 13) { event.preventDefault(); } }); }; /** * Assemble a list of all the filterable options on the form. * * @param $allOptions * A jQuery object representing the rows of filterable options to be * shown and hidden depending on the user's search terms. */ Drupal.viewsUi.OptionsSearch.prototype.getOptions = function ($allOptions) { var $ = jQuery; var i, $label, $description, $option; var options = []; var length = $allOptions.length; for (i = 0; i < length; i++) { $option = $($allOptions[i]); $label = $option.find('label'); $description = $option.find('div.description'); options[i] = { // Search on the lowercase version of the label text + description. 'searchText': $label.text().toLowerCase() + " " + $description.text().toLowerCase(), // Maintain a reference to the jQuery object for each row, so we don't // have to create a new object inside the performance-sensitive keyup // handler. '$div': $option } } return options; }; /** * Keyup handler for the search box that hides or shows the relevant options. */ Drupal.viewsUi.OptionsSearch.prototype.handleKeyup = function (event) { var found, i, j, option, search, words, wordsLength, zebraClass, zebraCounter; // Determine the user's search query. The search text has been converted to // lowercase. search = this.$searchBox.val().toLowerCase(); words = search.split(' '); wordsLength = words.length; // Start the counter for restriping rows. zebraCounter = 0; // Search through the search texts in the form for matching text. var length = this.options.length; for (i = 0; i < length; i++) { // Use a local variable for the option being searched, for performance. option = this.options[i]; found = true; // Each word in the search string has to match the item in order for the // item to be shown. for (j = 0; j < wordsLength; j++) { if (option.searchText.indexOf(words[j]) === -1) { found = false; } } if (found) { // Show the checkbox row, and restripe it. zebraClass = (zebraCounter % 2) ? 'odd' : 'even'; option.$div.show(); option.$div.removeClass('even odd'); option.$div.addClass(zebraClass); zebraCounter++; } else { // The search string wasn't found; hide this item. option.$div.hide(); } } }; Drupal.behaviors.viewsUiPreview = {}; Drupal.behaviors.viewsUiPreview.attach = function (context, settings) { var $ = jQuery; // Only act on the edit view form. var contextualFiltersBucket = $('.views-display-column .views-ui-display-tab-bucket.contextual-filters', context); if (contextualFiltersBucket.length == 0) { return; } // If the display has no contextual filters, hide the form where you enter // the contextual filters for the live preview. If it has contextual filters, // show the form. var contextualFilters = $('.views-display-setting a', contextualFiltersBucket); if (contextualFilters.length) { $('#preview-args').parent().show(); } else { $('#preview-args').parent().hide(); } // Executes an initial preview. if ($('#edit-displays-live-preview').once('edit-displays-live-preview').is(':checked')) { $('#preview-submit').once('edit-displays-live-preview').click(); } }; Drupal.behaviors.viewsUiRearrangeFilter = {}; Drupal.behaviors.viewsUiRearrangeFilter.attach = function (context, settings) { var $ = jQuery; // Only act on the rearrange filter form. if (typeof Drupal.tableDrag == 'undefined' || typeof Drupal.tableDrag['views-rearrange-filters'] == 'undefined') { return; } var table = $('#views-rearrange-filters', context).once('views-rearrange-filters'); var operator = $('.form-item-filter-groups-operator', context).once('views-rearrange-filters'); if (table.length) { new Drupal.viewsUi.rearrangeFilterHandler(table, operator); } }; /** * Improve the UI of the rearrange filters dialog box. */ Drupal.viewsUi.rearrangeFilterHandler = function (table, operator) { var $ = jQuery; // Keep a reference to the <table> being altered and to the div containing // the filter groups operator dropdown (if it exists). this.table = table; this.operator = operator; this.hasGroupOperator = this.operator.length > 0; // Keep a reference to all draggable rows within the table. this.draggableRows = $('.draggable', table); // Keep a reference to the buttons for adding and removing filter groups. this.addGroupButton = $('input#views-add-group'); this.removeGroupButtons = $('input.views-remove-group', table); // Add links that duplicate the functionality of the (hidden) add and remove // buttons. this.insertAddRemoveFilterGroupLinks(); // When there is a filter groups operator dropdown on the page, create // duplicates of the dropdown between each pair of filter groups. if (this.hasGroupOperator) { this.dropdowns = this.duplicateGroupsOperator(); this.syncGroupsOperators(); } // Add methods to the tableDrag instance to account for operator cells (which // span multiple rows), the operator labels next to each filter (e.g., "And" // or "Or"), the filter groups, and other special aspects of this tableDrag // instance. this.modifyTableDrag(); // Initialize the operator labels (e.g., "And" or "Or") that are displayed // next to the filters in each group, and bind a handler so that they change // based on the values of the operator dropdown within that group. this.redrawOperatorLabels(); $('.views-group-title select', table) .once('views-rearrange-filter-handler') .bind('change.views-rearrange-filter-handler', $.proxy(this, 'redrawOperatorLabels')); // Bind handlers so that when a "Remove" link is clicked, we: // - Update the rowspans of cells containing an operator dropdown (since they // need to change to reflect the number of rows in each group). // - Redraw the operator labels next to the filters in the group (since the // filter that is currently displayed last in each group is not supposed to // have a label display next to it). $('a.views-groups-remove-link', this.table) .once('views-rearrange-filter-handler') .bind('click.views-rearrange-filter-handler', $.proxy(this, 'updateRowspans')) .bind('click.views-rearrange-filter-handler', $.proxy(this, 'redrawOperatorLabels')); }; /** * Insert links that allow filter groups to be added and removed. */ Drupal.viewsUi.rearrangeFilterHandler.prototype.insertAddRemoveFilterGroupLinks = function () { var $ = jQuery; // Insert a link for adding a new group at the top of the page, and make it // match the action links styling used in a typical page.tpl.php. Note that // Drupal does not provide a theme function for this markup, so this is the // best we can do. $('<ul class="action-links"><li><a id="views-add-group-link" href="#">' + this.addGroupButton.val() + '</a></li></ul>') .prependTo(this.table.parent()) // When the link is clicked, dynamically click the hidden form button for // adding a new filter group. .once('views-rearrange-filter-handler') .bind('click.views-rearrange-filter-handler', $.proxy(this, 'clickAddGroupButton')); // Find each (visually hidden) button for removing a filter group and insert // a link next to it. var length = this.removeGroupButtons.length; for (i = 0; i < length; i++) { var $removeGroupButton = $(this.removeGroupButtons[i]); var buttonId = $removeGroupButton.attr('id'); $('<a href="#" class="views-remove-group-link">' + Drupal.t('Remove group') + '</a>') .insertBefore($removeGroupButton) // When the link is clicked, dynamically click the corresponding form // button. .once('views-rearrange-filter-handler') .bind('click.views-rearrange-filter-handler', {buttonId: buttonId}, $.proxy(this, 'clickRemoveGroupButton')); } }; /** * Dynamically click the button that adds a new filter group. */ Drupal.viewsUi.rearrangeFilterHandler.prototype.clickAddGroupButton = function () { // Due to conflicts between Drupal core's AJAX system and the Views AJAX // system, the only way to get this to work seems to be to trigger both the // .mousedown() and .submit() events. this.addGroupButton.mousedown(); this.addGroupButton.submit(); return false; }; /** * Dynamically click a button for removing a filter group. * * @param event * Event being triggered, with event.data.buttonId set to the ID of the * form button that should be clicked. */ Drupal.viewsUi.rearrangeFilterHandler.prototype.clickRemoveGroupButton = function (event) { // For some reason, here we only need to trigger .submit(), unlike for // Drupal.viewsUi.rearrangeFilterHandler.prototype.clickAddGroupButton() // where we had to trigger .mousedown() also. jQuery('input#' + event.data.buttonId, this.table).submit(); return false; }; /** * Move the groups operator so that it's between the first two groups, and * duplicate it between any subsequent groups. */ Drupal.viewsUi.rearrangeFilterHandler.prototype.duplicateGroupsOperator = function () { var $ = jQuery; var dropdowns, newRow; var titleRows = $('tr.views-group-title'), titleRow; // Get rid of the explanatory text around the operator; its placement is // explanatory enough. this.operator.find('label').add('div.description').addClass('element-invisible'); this.operator.find('select').addClass('form-select'); // Keep a list of the operator dropdowns, so we can sync their behavior later. dropdowns = this.operator; // Move the operator to a new row just above the second group. titleRow = $('tr#views-group-title-2'); newRow = $('<tr class="filter-group-operator-row"><td colspan="5"></td></tr>'); newRow.find('td').append(this.operator); newRow.insertBefore(titleRow); var i, length = titleRows.length; // Starting with the third group, copy the operator to a new row above the // group title. for (i = 2; i < length; i++) { titleRow = $(titleRows[i]); // Make a copy of the operator dropdown and put it in a new table row. var fakeOperator = this.operator.clone(); fakeOperator.attr('id', ''); newRow = $('<tr class="filter-group-operator-row"><td colspan="5"></td></tr>'); newRow.find('td').append(fakeOperator); newRow.insertBefore(titleRow); dropdowns = dropdowns.add(fakeOperator); } return dropdowns; }; /** * Make the duplicated groups operators change in sync with each other. */ Drupal.viewsUi.rearrangeFilterHandler.prototype.syncGroupsOperators = function () { if (this.dropdowns.length < 2) { // We only have one dropdown (or none at all), so there's nothing to sync. return; } this.dropdowns.change(jQuery.proxy(this, 'operatorChangeHandler')); }; /** * Click handler for the operators that appear between filter groups. * * Forces all operator dropdowns to have the same value. */ Drupal.viewsUi.rearrangeFilterHandler.prototype.operatorChangeHandler = function (event) { var $ = jQuery; var $target = $(event.target); var operators = this.dropdowns.find('select').not($target); // Change the other operators to match this new value. operators.val($target.val()); }; Drupal.viewsUi.rearrangeFilterHandler.prototype.modifyTableDrag = function () { var tableDrag = Drupal.tableDrag['views-rearrange-filters']; var filterHandler = this; /** * Override the row.onSwap method from tabledrag.js. * * When a row is dragged to another place in the table, several things need * to occur. * - The row needs to be moved so that it's within one of the filter groups. * - The operator cells that span multiple rows need their rowspan attributes * updated to reflect the number of rows in each group. * - The operator labels that are displayed next to each filter need to be * redrawn, to account for the row's new location. */ tableDrag.row.prototype.onSwap = function () { if (filterHandler.hasGroupOperator) { // Make sure the row that just got moved (this.group) is inside one of // the filter groups (i.e. below an empty marker row or a draggable). If // it isn't, move it down one. var thisRow = jQuery(this.group); var previousRow = thisRow.prev('tr'); if (previousRow.length && !previousRow.hasClass('group-message') && !previousRow.hasClass('draggable')) { // Move the dragged row down one. var next = thisRow.next(); if (next.is('tr')) { this.swap('after', next); } } filterHandler.updateRowspans(); } // Redraw the operator labels that are displayed next to each filter, to // account for the row's new location. filterHandler.redrawOperatorLabels(); }; /** * Override the onDrop method from tabledrag.js. */ tableDrag.onDrop = function () { var $ = jQuery; // If the tabledrag change marker (i.e., the "*") has been inserted inside // a row after the operator label (i.e., "And" or "Or") rearrange the items // so the operator label continues to appear last. var changeMarker = $(this.oldRowElement).find('.tabledrag-changed'); if (changeMarker.length) { // Search for occurrences of the operator label before the change marker, // and reverse them. var operatorLabel = changeMarker.prevAll('.views-operator-label'); if (operatorLabel.length) { operatorLabel.insertAfter(changeMarker); } } // Make sure the "group" dropdown is properly updated when rows are dragged // into an empty filter group. This is borrowed heavily from the block.js // implementation of tableDrag.onDrop(). var groupRow = $(this.rowObject.element).prevAll('tr.group-message').get(0); var groupName = groupRow.className.replace(/([^ ]+[ ]+)*group-([^ ]+)-message([ ]+[^ ]+)*/, '$2'); var groupField = $('select.views-group-select', this.rowObject.element); if ($(this.rowObject.element).prev('tr').is('.group-message') && !groupField.is('.views-group-select-' + groupName)) { var oldGroupName = groupField.attr('class').replace(/([^ ]+[ ]+)*views-group-select-([^ ]+)([ ]+[^ ]+)*/, '$2'); groupField.removeClass('views-group-select-' + oldGroupName).addClass('views-group-select-' + groupName); groupField.val(groupName); } }; }; /** * Redraw the operator labels that are displayed next to each filter. */ Drupal.viewsUi.rearrangeFilterHandler.prototype.redrawOperatorLabels = function () { var $ = jQuery; for (i = 0; i < this.draggableRows.length; i++) { // Within the row, the operator labels are displayed inside the first table // cell (next to the filter name). var $draggableRow = $(this.draggableRows[i]); var $firstCell = $('td:first', $draggableRow); if ($firstCell.length) { // The value of the operator label ("And" or "Or") is taken from the // first operator dropdown we encounter, going backwards from the current // row. This dropdown is the one associated with the current row's filter // group. var operatorValue = $draggableRow.prevAll('.views-group-title').find('option:selected').html(); var operatorLabel = '<span class="views-operator-label">' + operatorValue + '</span>'; // If the next visible row after this one is a draggable filter row, // display the operator label next to the current row. (Checking for // visibility is necessary here since the "Remove" links hide the removed // row but don't actually remove it from the document). var $nextRow = $draggableRow.nextAll(':visible').eq(0); var $existingOperatorLabel = $firstCell.find('.views-operator-label'); if ($nextRow.hasClass('draggable')) { // If an operator label was already there, replace it with the new one. if ($existingOperatorLabel.length) { $existingOperatorLabel.replaceWith(operatorLabel); } // Otherwise, append the operator label to the end of the table cell. else { $firstCell.append(operatorLabel); } } // If the next row doesn't contain a filter, then this is the last row // in the group. We don't want to display the operator there (since // operators should only display between two related filters, e.g. // "filter1 AND filter2 AND filter3"). So we remove any existing label // that this row has. else { $existingOperatorLabel.remove(); } } } }; /** * Update the rowspan attribute of each cell containing an operator dropdown. */ Drupal.viewsUi.rearrangeFilterHandler.prototype.updateRowspans = function () { var $ = jQuery; var i, $row, $currentEmptyRow, draggableCount, $operatorCell; var rows = $(this.table).find('tr'); var length = rows.length; for (i = 0; i < length; i++) { $row = $(rows[i]); if ($row.hasClass('views-group-title')) { // This row is a title row. // Keep a reference to the cell containing the dropdown operator. $operatorCell = $($row.find('td.group-operator')); // Assume this filter group is empty, until we find otherwise. draggableCount = 0; $currentEmptyRow = $row.next('tr'); $currentEmptyRow.removeClass('group-populated').addClass('group-empty'); // The cell with the dropdown operator should span the title row and // the "this group is empty" row. $operatorCell.attr('rowspan', 2); } else if (($row).hasClass('draggable') && $row.is(':visible')) { // We've found a visible filter row, so we now know the group isn't empty. draggableCount++; $currentEmptyRow.removeClass('group-empty').addClass('group-populated'); // The operator cell should span all draggable rows, plus the title. $operatorCell.attr('rowspan', draggableCount + 1); } } }; Drupal.behaviors.viewsFilterConfigSelectAll = {}; /** * Add a select all checkbox, which checks each checkbox at once. */ Drupal.behaviors.viewsFilterConfigSelectAll.attach = function(context) { var $ = jQuery; // Show the select all checkbox. $('#views-ui-config-item-form div.form-item-options-value-all', context).once(function() { $(this).show(); }) .find('input[type=checkbox]') .click(function() { var checked = $(this).is(':checked'); // Update all checkbox beside the select all checkbox. $(this).parents('.form-checkboxes').find('input[type=checkbox]').each(function() { $(this).attr('checked', checked); }); }); // Uncheck the select all checkbox if any of the others are unchecked. $('#views-ui-config-item-form div.form-type-checkbox').not($('.form-item-options-value-all')).find('input[type=checkbox]').each(function() { $(this).click(function() { if ($(this).is('checked') == 0) { $('#edit-options-value-all').removeAttr('checked'); } }); }); }; /** * Ensure the desired default button is used when a form is implicitly submitted via an ENTER press on textfields, radios, and checkboxes. * * @see http://www.w3.org/TR/html5/association-of-controls-and-forms.html#implicit-submission */ Drupal.behaviors.viewsImplicitFormSubmission = {}; Drupal.behaviors.viewsImplicitFormSubmission.attach = function (context, settings) { var $ = jQuery; $(':text, :password, :radio, :checkbox', context).once('viewsImplicitFormSubmission', function() { $(this).keypress(function(event) { if (event.which == 13) { var formId = this.form.id; if (formId && settings.viewsImplicitFormSubmission && settings.viewsImplicitFormSubmission[formId] && settings.viewsImplicitFormSubmission[formId].defaultButton) { event.preventDefault(); var buttonId = settings.viewsImplicitFormSubmission[formId].defaultButton; var $button = $('#' + buttonId, this.form); if ($button.length == 1 && $button.is(':enabled')) { if (Drupal.ajax && Drupal.ajax[buttonId]) { $button.trigger(Drupal.ajax[buttonId].element_settings.event); } else { $button.click(); } } } } }); }); }; /** * Remove icon class from elements that are themed as buttons or dropbuttons. */ Drupal.behaviors.viewsRemoveIconClass = {}; Drupal.behaviors.viewsRemoveIconClass.attach = function (context, settings) { jQuery('.ctools-button', context).once('RemoveIconClass', function () { var $ = jQuery; var $this = $(this); $('.icon', $this).removeClass('icon'); $('.horizontal', $this).removeClass('horizontal'); }); }; /** * Change "Expose filter" buttons into checkboxes. */ Drupal.behaviors.viewsUiCheckboxify = {}; Drupal.behaviors.viewsUiCheckboxify.attach = function (context, settings) { var $ = jQuery; var $buttons = $('#edit-options-expose-button-button, #edit-options-group-button-button').once('views-ui-checkboxify'); var length = $buttons.length; var i; for (i = 0; i < length; i++) { new Drupal.viewsUi.Checkboxifier($buttons[i]); } }; /** * Change the default widget to select the default group according to the * selected widget for the exposed group. */ Drupal.behaviors.viewsUiChangeDefaultWidget = {}; Drupal.behaviors.viewsUiChangeDefaultWidget.attach = function (context, settings) { var $ = jQuery; function change_default_widget(multiple) { if (multiple) { $('input.default-radios').hide(); $('td.any-default-radios-row').parent().hide(); $('input.default-checkboxes').show(); } else { $('input.default-checkboxes').hide(); $('td.any-default-radios-row').parent().show(); $('input.default-radios').show(); } } // Update on widget change. $('input[name="options[group_info][multiple]"]').change(function() { change_default_widget($(this).attr("checked")); }); // Update the first time the form is rendered. $('input[name="options[group_info][multiple]"]').trigger('change'); }; /** * Attaches an expose filter button to a checkbox that triggers its click event. * * @param button * The DOM object representing the button to be checkboxified. */ Drupal.viewsUi.Checkboxifier = function (button) { var $ = jQuery; this.$button = $(button); this.$parent = this.$button.parent('div.views-expose, div.views-grouped'); this.$input = this.$parent.find('input:checkbox, input:radio'); // Hide the button and its description. this.$button.hide(); this.$parent.find('.exposed-description, .grouped-description').hide(); this.$input.click($.proxy(this, 'clickHandler')); }; /** * When the checkbox is checked or unchecked, simulate a button press. */ Drupal.viewsUi.Checkboxifier.prototype.clickHandler = function (e) { this.$button.mousedown(); this.$button.submit(); }; /** * Change the Apply button text based upon the override select state. */ Drupal.behaviors.viewsUiOverrideSelect = {}; Drupal.behaviors.viewsUiOverrideSelect.attach = function (context, settings) { var $ = jQuery; $('#edit-override-dropdown', context).once('views-ui-override-button-text', function() { // Closures! :( var $submit = $('#edit-submit', context); var old_value = $submit.val(); $submit.once('views-ui-override-button-text') .bind('mouseup', function() { $(this).val(old_value); return true; }); $(this).bind('change', function() { if ($(this).val() == 'default') { $submit.val(Drupal.t('Apply (all displays)')); } else if ($(this).val() == 'default_revert') { $submit.val(Drupal.t('Revert to default')); } else { $submit.val(Drupal.t('Apply (this display)')); } }) .trigger('change'); }); }; Drupal.viewsUi.resizeModal = function (e, no_shrink) { var $ = jQuery; var $modal = $('.views-ui-dialog'); var $scroll = $('.scroll', $modal); if ($modal.size() == 0 || $modal.css('display') == 'none') { return; } var maxWidth = parseInt($(window).width() * .85); // 70% of window var minWidth = parseInt($(window).width() * .6); // 70% of window // Set the modal to the minwidth so that our width calculation of // children works. $modal.css('width', minWidth); var width = minWidth; // Don't let the window get more than 80% of the display high. var maxHeight = parseInt($(window).height() * .8); var minHeight = 200; if (no_shrink) { minHeight = $modal.height(); } if (minHeight > maxHeight) { minHeight = maxHeight; } var height = 0; // Calculate the height of the 'scroll' region. var scrollHeight = 0; scrollHeight += parseInt($scroll.css('padding-top')); scrollHeight += parseInt($scroll.css('padding-bottom')); $scroll.children().each(function() { var w = $(this).innerWidth(); if (w > width) { width = w; } scrollHeight += $(this).outerHeight(true); }); // Now, calculate what the difference between the scroll and the modal // will be. var difference = 0; difference += parseInt($scroll.css('padding-top')); difference += parseInt($scroll.css('padding-bottom')); difference += $('.views-override').outerHeight(true); difference += $('.views-messages').outerHeight(true); difference += $('#views-ajax-title').outerHeight(true); difference += $('.views-add-form-selected').outerHeight(true); difference += $('.form-buttons', $modal).outerHeight(true); height = scrollHeight + difference; if (height > maxHeight) { height = maxHeight; scrollHeight = maxHeight - difference; } else if (height < minHeight) { height = minHeight; scrollHeight = minHeight - difference; } if (width > maxWidth) { width = maxWidth; } // Get where we should move content to var top = ($(window).height() / 2) - (height / 2); var left = ($(window).width() / 2) - (width / 2); $modal.css({ 'top': top + 'px', 'left': left + 'px', 'width': width + 'px', 'height': height + 'px' }); // Ensure inner popup height matches. $(Drupal.settings.views.ajax.popup).css('height', height + 'px'); $scroll.css({ 'height': scrollHeight + 'px', 'max-height': scrollHeight + 'px' }); }; jQuery(function() { jQuery(window).bind('resize', Drupal.viewsUi.resizeModal); jQuery(window).bind('scroll', Drupal.viewsUi.resizeModal); });
JavaScript
/** * @file * Javascript related to the main view list. */ (function ($) { Drupal.behaviors.viewsUIList = { attach: function (context) { $('#ctools-export-ui-list-items thead a').once('views-ajax-processed').each(function() { $(this).click(function() { var query = $.deparam.querystring(this.href); $('#ctools-export-ui-list-form select[name=order]').val(query['order']); $('#ctools-export-ui-list-form select[name=sort]').val(query['sort']); $('#ctools-export-ui-list-form input.ctools-auto-submit-click').trigger('click'); return false; }); }); } }; })(jQuery);
JavaScript
/** * @file * Handles AJAX fetching of views, including filter submission and response. */ (function ($) { /** * Attaches the AJAX behavior to Views exposed filter forms and key View links. */ Drupal.behaviors.ViewsAjaxView = {}; Drupal.behaviors.ViewsAjaxView.attach = function() { if (Drupal.settings && Drupal.settings.views && Drupal.settings.views.ajaxViews) { $.each(Drupal.settings.views.ajaxViews, function(i, settings) { Drupal.views.instances[i] = new Drupal.views.ajaxView(settings); }); } }; Drupal.views = {}; Drupal.views.instances = {}; /** * Javascript object for a certain view. */ Drupal.views.ajaxView = function(settings) { var selector = '.view-dom-id-' + settings.view_dom_id; this.$view = $(selector); // Retrieve the path to use for views' ajax. var ajax_path = Drupal.settings.views.ajax_path; // If there are multiple views this might've ended up showing up multiple times. if (ajax_path.constructor.toString().indexOf("Array") != -1) { ajax_path = ajax_path[0]; } // Check if there are any GET parameters to send to views. var queryString = window.location.search || ''; if (queryString !== '') { // Remove the question mark and Drupal path component if any. var queryString = queryString.slice(1).replace(/q=[^&]+&?|&?render=[^&]+/, ''); if (queryString !== '') { // If there is a '?' in ajax_path, clean url are on and & should be used to add parameters. queryString = ((/\?/.test(ajax_path)) ? '&' : '?') + queryString; } } this.element_settings = { url: ajax_path + queryString, submit: settings, setClick: true, event: 'click', selector: selector, progress: { type: 'throbber' } }; this.settings = settings; // Add the ajax to exposed forms. this.$exposed_form = $('form#views-exposed-form-'+ settings.view_name.replace(/_/g, '-') + '-' + settings.view_display_id.replace(/_/g, '-')); this.$exposed_form.once(jQuery.proxy(this.attachExposedFormAjax, this)); // Add the ajax to pagers. this.$view // Don't attach to nested views. Doing so would attach multiple behaviors // to a given element. .filter(jQuery.proxy(this.filterNestedViews, this)) .once(jQuery.proxy(this.attachPagerAjax, this)); }; Drupal.views.ajaxView.prototype.attachExposedFormAjax = function() { var button = $('input[type=submit], input[type=image]', this.$exposed_form); button = button[0]; this.exposedFormAjax = new Drupal.ajax($(button).attr('id'), button, this.element_settings); }; Drupal.views.ajaxView.prototype.filterNestedViews= function() { // If there is at least one parent with a view class, this view // is nested (e.g., an attachment). Bail. return !this.$view.parents('.view').size(); }; /** * Attach the ajax behavior to each link. */ Drupal.views.ajaxView.prototype.attachPagerAjax = function() { this.$view.find('ul.pager > li > a, th.views-field a, .attachment .views-summary a') .each(jQuery.proxy(this.attachPagerLinkAjax, this)); }; /** * Attach the ajax behavior to a singe link. */ Drupal.views.ajaxView.prototype.attachPagerLinkAjax = function(id, link) { var $link = $(link); var viewData = {}; var href = $link.attr('href'); // Construct an object using the settings defaults and then overriding // with data specific to the link. $.extend( viewData, this.settings, Drupal.Views.parseQueryString(href), // Extract argument data from the URL. Drupal.Views.parseViewArgs(href, this.settings.view_base_path) ); // For anchor tags, these will go to the target of the anchor rather // than the usual location. $.extend(viewData, Drupal.Views.parseViewArgs(href, this.settings.view_base_path)); this.element_settings.submit = viewData; this.pagerAjax = new Drupal.ajax(false, $link, this.element_settings); }; Drupal.ajax.prototype.commands.viewsScrollTop = function (ajax, response, status) { // Scroll to the top of the view. This will allow users // to browse newly loaded content after e.g. clicking a pager // link. var offset = $(response.selector).offset(); // We can't guarantee that the scrollable object should be // the body, as the view could be embedded in something // more complex such as a modal popup. Recurse up the DOM // and scroll the first element that has a non-zero top. var scrollTarget = response.selector; while ($(scrollTarget).scrollTop() == 0 && $(scrollTarget).parent()) { scrollTarget = $(scrollTarget).parent(); } // Only scroll upward if (offset.top - 10 < $(scrollTarget).scrollTop()) { $(scrollTarget).animate({scrollTop: (offset.top - 10)}, 500); } }; })(jQuery);
JavaScript
/** * @file * Javascript related to contextual links. */ (function ($) { Drupal.behaviors.viewsContextualLinks = { attach: function (context) { // If there are views-related contextual links attached to the main page // content, find the smallest region that encloses both the links and the // view, and display it as a contextual links region. $('.views-contextual-links-page', context).closest(':has(.view)').addClass('contextual-links-region'); } }; })(jQuery);
JavaScript
/** * @file * Some basic behaviors and utility functions for Views. */ (function ($) { Drupal.Views = {}; /** * jQuery UI tabs, Views integration component */ Drupal.behaviors.viewsTabs = { attach: function (context) { if ($.viewsUi && $.viewsUi.tabs) { $('#views-tabset').once('views-processed').viewsTabs({ selectedClass: 'active' }); } $('a.views-remove-link').once('views-processed').click(function(event) { var id = $(this).attr('id').replace('views-remove-link-', ''); $('#views-row-' + id).hide(); $('#views-removed-' + id).attr('checked', true); event.preventDefault(); }); /** * Here is to handle display deletion * (checking in the hidden checkbox and hiding out the row) */ $('a.display-remove-link') .addClass('display-processed') .click(function() { var id = $(this).attr('id').replace('display-remove-link-', ''); $('#display-row-' + id).hide(); $('#display-removed-' + id).attr('checked', true); return false; }); } }; /** * Helper function to parse a querystring. */ Drupal.Views.parseQueryString = function (query) { var args = {}; var pos = query.indexOf('?'); if (pos != -1) { query = query.substring(pos + 1); } var pairs = query.split('&'); for(var i in pairs) { if (typeof(pairs[i]) == 'string') { var pair = pairs[i].split('='); // Ignore the 'q' path argument, if present. if (pair[0] != 'q' && pair[1]) { args[decodeURIComponent(pair[0].replace(/\+/g, ' '))] = decodeURIComponent(pair[1].replace(/\+/g, ' ')); } } } return args; }; /** * Helper function to return a view's arguments based on a path. */ Drupal.Views.parseViewArgs = function (href, viewPath) { var returnObj = {}; var path = Drupal.Views.getPath(href); // Ensure we have a correct path. if (viewPath && path.substring(0, viewPath.length + 1) == viewPath + '/') { var args = decodeURIComponent(path.substring(viewPath.length + 1, path.length)); returnObj.view_args = args; returnObj.view_path = path; } return returnObj; }; /** * Strip off the protocol plus domain from an href. */ Drupal.Views.pathPortion = function (href) { // Remove e.g. http://example.com if present. var protocol = window.location.protocol; if (href.substring(0, protocol.length) == protocol) { // 2 is the length of the '//' that normally follows the protocol href = href.substring(href.indexOf('/', protocol.length + 2)); } return href; }; /** * Return the Drupal path portion of an href. */ Drupal.Views.getPath = function (href) { href = Drupal.Views.pathPortion(href); href = href.substring(Drupal.settings.basePath.length, href.length); // 3 is the length of the '?q=' added to the url without clean urls. if (href.substring(0, 3) == '?q=') { href = href.substring(3, href.length); } var chars = ['#', '?', '&']; for (i in chars) { if (href.indexOf(chars[i]) > -1) { href = href.substr(0, href.indexOf(chars[i])); } } return href; }; })(jQuery);
JavaScript
/** * @file * Handles AJAX submission and response in Views UI. */ (function ($) { Drupal.ajax.prototype.commands.viewsSetForm = function (ajax, response, status) { var ajax_title = Drupal.settings.views.ajax.title; var ajax_body = Drupal.settings.views.ajax.id; var ajax_popup = Drupal.settings.views.ajax.popup; $(ajax_title).html(response.title); $(ajax_body).html(response.output); $(ajax_popup).dialog('open'); Drupal.attachBehaviors($(ajax_popup), ajax.settings); if (response.url) { // Identify the button that was clicked so that .ajaxSubmit() can use it. // We need to do this for both .click() and .mousedown() since JavaScript // code might trigger either behavior. var $submit_buttons = $('input[type=submit], button', ajax_body); $submit_buttons.click(function(event) { this.form.clk = this; }); $submit_buttons.mousedown(function(event) { this.form.clk = this; }); $('form', ajax_body).once('views-ajax-submit-processed').each(function() { var element_settings = { 'url': response.url, 'event': 'submit', 'progress': { 'type': 'throbber' } }; var $form = $(this); var id = $form.attr('id'); Drupal.ajax[id] = new Drupal.ajax(id, this, element_settings); Drupal.ajax[id].form = $form; }); } Drupal.viewsUi.resizeModal(); }; Drupal.ajax.prototype.commands.viewsDismissForm = function (ajax, response, status) { Drupal.ajax.prototype.commands.viewsSetForm({}, {'title': '', 'output': Drupal.settings.views.ajax.defaultForm}); $(Drupal.settings.views.ajax.popup).dialog('close'); } Drupal.ajax.prototype.commands.viewsHilite = function (ajax, response, status) { $('.hilited').removeClass('hilited'); $(response.selector).addClass('hilited'); }; Drupal.ajax.prototype.commands.viewsAddTab = function (ajax, response, status) { var id = '#views-tab-' + response.id; $('#views-tabset').viewsAddTab(id, response.title, 0); $(id).html(response.body).addClass('views-tab'); // Update the preview widget to preview the new tab. var display_id = id.replace('#views-tab-', ''); $("#preview-display-id").append('<option selected="selected" value="' + display_id + '">' + response.title + '</option>'); Drupal.attachBehaviors(id); var instance = $.viewsUi.tabs.instances[$('#views-tabset').get(0).UI_TABS_UUID]; $('#views-tabset').viewsClickTab(instance.$tabs.length); }; Drupal.ajax.prototype.commands.viewsShowButtons = function (ajax, response, status) { $('div.views-edit-view div.form-actions').removeClass('js-hide'); $('div.views-edit-view div.view-changed.messages').removeClass('js-hide'); }; Drupal.ajax.prototype.commands.viewsTriggerPreview = function (ajax, response, status) { if ($('input#edit-displays-live-preview').is(':checked')) { $('#preview-submit').trigger('click'); } }; Drupal.ajax.prototype.commands.viewsReplaceTitle = function (ajax, response, status) { // In case we're in the overlay, get a reference to the underlying window. var doc = parent.document; // For the <title> element, make a best-effort attempt to replace the page // title and leave the site name alone. If the theme doesn't use the site // name in the <title> element, this will fail. var oldTitle = doc.title; // Escape the site name, in case it has special characters in it, so we can // use it in our regex. var escapedSiteName = response.siteName.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); var re = new RegExp('.+ (.) ' + escapedSiteName); doc.title = oldTitle.replace(re, response.title + ' $1 ' + response.siteName); $('h1.page-title').text(response.title); $('h1#overlay-title').text(response.title); }; /** * Get rid of irritating tabledrag messages */ Drupal.theme.tableDragChangedWarning = function () { return []; } /** * Trigger preview when the "live preview" checkbox is checked. */ Drupal.behaviors.livePreview = { attach: function (context) { $('input#edit-displays-live-preview', context).once('views-ajax-processed').click(function() { if ($(this).is(':checked')) { $('#preview-submit').click(); } }); } } /** * Sync preview display. */ Drupal.behaviors.syncPreviewDisplay = { attach: function (context) { $("#views-tabset a").once('views-ajax-processed').click(function() { var href = $(this).attr('href'); // Cut of #views-tabset. var display_id = href.substr(11); // Set the form element. $("#views-live-preview #preview-display-id").val(display_id); }).addClass('views-ajax-processed'); } } Drupal.behaviors.viewsAjax = { collapseReplaced: false, attach: function (context, settings) { if (!settings.views) { return; } // Create a jQuery UI dialog, but leave it closed. var dialog_area = $(settings.views.ajax.popup, context); dialog_area.dialog({ 'autoOpen': false, 'dialogClass': 'views-ui-dialog', 'modal': true, 'position': 'center', 'resizable': false, 'width': 750 }); var base_element_settings = { 'event': 'click', 'progress': { 'type': 'throbber' } }; // Bind AJAX behaviors to all items showing the class. $('a.views-ajax-link', context).once('views-ajax-processed').each(function () { var element_settings = base_element_settings; // Set the URL to go to the anchor. if ($(this).attr('href')) { element_settings.url = $(this).attr('href'); } var base = $(this).attr('id'); Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings); }); $('div#views-live-preview a') .once('views-ajax-processed').each(function () { // We don't bind to links without a URL. if (!$(this).attr('href')) { return true; } var element_settings = base_element_settings; // Set the URL to go to the anchor. element_settings.url = $(this).attr('href'); if (Drupal.Views.getPath(element_settings.url).substring(0, 21) != 'admin/structure/views') { return true; } element_settings.wrapper = 'views-live-preview'; element_settings.method = 'html'; var base = $(this).attr('id'); Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings); }); // Within a live preview, make exposed widget form buttons re-trigger the // Preview button. // @todo Revisit this after fixing Views UI to display a Preview outside // of the main Edit form. $('div#views-live-preview input[type=submit]') .once('views-ajax-processed').each(function(event) { $(this).click(function () { this.form.clk = this; return true; }); var element_settings = base_element_settings; // Set the URL to go to the anchor. element_settings.url = $(this.form).attr('action'); if (Drupal.Views.getPath(element_settings.url).substring(0, 21) != 'admin/structure/views') { return true; } element_settings.wrapper = 'views-live-preview'; element_settings.method = 'html'; element_settings.event = 'click'; var base = $(this).attr('id'); Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings); }); if (!this.collapseReplaced && Drupal.collapseScrollIntoView) { this.collapseReplaced = true; Drupal.collapseScrollIntoView = function (node) { for (var $parent = $(node); $parent.get(0) != document && $parent.size() != 0; $parent = $parent.parent()) { if ($parent.css('overflow') == 'scroll' || $parent.css('overflow') == 'auto') { if (Drupal.viewsUi.resizeModal) { // If the modal is already at the max height, don't bother with // this since the only reason to do it is to grow the modal. if ($('.views-ui-dialog').height() < parseInt($(window).height() * .8)) { Drupal.viewsUi.resizeModal('', true); } } return; } } var h = document.documentElement.clientHeight || document.body.clientHeight || 0; var offset = document.documentElement.scrollTop || document.body.scrollTop || 0; var posY = $(node).offset().top; var fudge = 55; if (posY + node.offsetHeight + fudge > h + offset) { if (node.offsetHeight > h) { window.scrollTo(0, posY); } else { window.scrollTo(0, posY + node.offsetHeight - h + fudge); } } }; } } }; })(jQuery);
JavaScript
(function($){ Drupal.behaviors.contextReactionBlock = {attach: function(context) { $('form.context-editor:not(.context-block-processed)') .addClass('context-block-processed') .each(function() { var id = $(this).attr('id'); Drupal.contextBlockEditor = Drupal.contextBlockEditor || {}; $(this).bind('init.pageEditor', function(event) { Drupal.contextBlockEditor[id] = new DrupalContextBlockEditor($(this)); }); $(this).bind('start.pageEditor', function(event, context) { // Fallback to first context if param is empty. if (!context) { context = $(this).data('defaultContext'); } Drupal.contextBlockEditor[id].editStart($(this), context); }); $(this).bind('end.pageEditor', function(event) { Drupal.contextBlockEditor[id].editFinish(); }); }); // // Admin Form ======================================================= // // ContextBlockForm: Init. $('#context-blockform:not(.processed)').each(function() { $(this).addClass('processed'); Drupal.contextBlockForm = new DrupalContextBlockForm($(this)); Drupal.contextBlockForm.setState(); }); // ContextBlockForm: Attach block removal handlers. // Lives in behaviors as it may be required for attachment to new DOM elements. $('#context-blockform a.remove:not(.processed)').each(function() { $(this).addClass('processed'); $(this).click(function() { $(this).parents('tr').eq(0).remove(); Drupal.contextBlockForm.setState(); return false; }); }); // Conceal Section title, subtitle and class $('div.context-block-browser', context).nextAll('.form-item').hide(); }}; /** * Context block form. Default form for editing context block reactions. */ DrupalContextBlockForm = function(blockForm) { this.state = {}; this.setState = function() { $('table.context-blockform-region', blockForm).each(function() { var region = $(this).attr('id').split('context-blockform-region-')[1]; var blocks = []; $('tr', $(this)).each(function() { var bid = $(this).attr('id'); var weight = $(this).find('select,input').first().val(); blocks.push({'bid' : bid, 'weight' : weight}); }); Drupal.contextBlockForm.state[region] = blocks; }); // Serialize here and set form element value. $('form input.context-blockform-state').val(JSON.stringify(this.state)); // Hide enabled blocks from selector that are used $('table.context-blockform-region tr').each(function() { var bid = $(this).attr('id'); $('div.context-blockform-selector input[value='+bid+']').parents('div.form-item').eq(0).hide(); }); // Show blocks in selector that are unused $('div.context-blockform-selector input').each(function() { var bid = $(this).val(); if ($('table.context-blockform-region tr#'+bid).size() === 0) { $(this).parents('div.form-item').eq(0).show(); } }); }; // make sure we update the state right before submits, this takes care of an // apparent race condition between saving the state and the weights getting set // by tabledrag $('#ctools-export-ui-edit-item-form').submit(function() { Drupal.contextBlockForm.setState(); }); // Tabledrag // Add additional handlers to update our blocks. $.each(Drupal.settings.tableDrag, function(base) { var table = $('#' + base + ':not(.processed)', blockForm); if (table && table.is('.context-blockform-region')) { table.addClass('processed'); table.bind('mouseup', function(event) { Drupal.contextBlockForm.setState(); return; }); } }); // Add blocks to a region $('td.blocks a', blockForm).each(function() { $(this).click(function() { var region = $(this).attr('href').split('#')[1]; var base = "context-blockform-region-"+ region; var selected = $("div.context-blockform-selector input:checked"); if (selected.size() > 0) { var weight_warn = false; var min_weight_option = -10; var max_weight_option = 10; var max_observed_weight = min_weight_option - 1; $('table#' + base + ' tr').each(function() { var weight_input_val = $(this).find('select,input').first().val(); if (+weight_input_val > +max_observed_weight) { max_observed_weight = weight_input_val; } }); selected.each(function() { // create new block markup var block = document.createElement('tr'); var text = $(this).parents('div.form-item').eq(0).hide().children('label').text(); var select = '<div class="form-item form-type-select"><select class="tabledrag-hide form-select">'; var i; weight_warn = true; var selected_weight = max_weight_option; if (max_weight_option >= (1 + +max_observed_weight)) { selected_weight = ++max_observed_weight; weight_warn = false; } for (i = min_weight_option; i <= max_weight_option; ++i) { select += '<option'; if (i == selected_weight) { select += ' selected=selected'; } select += '>' + i + '</option>'; } select += '</select></div>'; $(block).attr('id', $(this).attr('value')).addClass('draggable'); $(block).html("<td>"+ text + "</td><td>" + select + "</td><td><a href='' class='remove'>X</a></td>"); // add block item to region //TODO : Fix it so long blocks don't get stuck when added to top regions and dragged towards bottom regions Drupal.tableDrag[base].makeDraggable(block); $('table#'+base).append(block); if ($.cookie('Drupal.tableDrag.showWeight') == 1) { $('table#'+base).find('.tabledrag-hide').css('display', ''); $('table#'+base).find('.tabledrag-handle').css('display', 'none'); } else { $('table#'+base).find('.tabledrag-hide').css('display', 'none'); $('table#'+base).find('.tabledrag-handle').css('display', ''); } Drupal.attachBehaviors($('table#'+base)); Drupal.contextBlockForm.setState(); $(this).removeAttr('checked'); }); if (weight_warn) { alert(Drupal.t('Desired block weight exceeds available weight options, please check weights for blocks before saving')); } } return false; }); }); }; /** * Context block editor. AHAH editor for live block reaction editing. */ DrupalContextBlockEditor = function(editor) { this.editor = editor; this.state = {}; this.blocks = {}; this.regions = {}; return this; }; DrupalContextBlockEditor.prototype = { initBlocks : function(blocks) { var self = this; this.blocks = blocks; blocks.each(function() { if($(this).hasClass('context-block-empty')) { $(this).removeClass('context-block-hidden'); } $(this).addClass('draggable'); $(this).prepend($('<a class="context-block-handle"></a>')); $(this).prepend($('<a class="context-block-remove"></a>').click(function() { $(this).parent ('.block').eq(0).fadeOut('medium', function() { $(this).remove(); self.updateBlocks(); }); return false; })); }); }, initRegions : function(regions) { this.regions = regions; var ref = this; $(regions).not('.context-ui-processed') .each(function(index, el) { $('.context-ui-add-link', el).click(function(e){ ref.showBlockBrowser($(this).parent()); }).addClass('context-ui-processed'); }); $('.context-block-browser').hide(); }, showBlockBrowser : function(region) { var toggled = false; //figure out the id of the context var activeId = $('.context-editing', this.editor).attr('id').replace('-trigger', ''), context = $('#' + activeId)[0]; this.browser = $('.context-block-browser', context).addClass('active'); //add the filter element to the block browser if (!this.browser.has('input.filter').size()) { var parent = $('.block-browser-sidebar .filter', this.browser); var list = $('.blocks', this.browser); new Drupal.Filter (list, false, '.context-block-addable', parent); } //show a dialog for the blocks list this.browser.show().dialog({ modal : true, close : function() { $(this).dialog('destroy'); //reshow all the categories $('.category', this).show(); $(this).hide().appendTo(context).removeClass('active'); }, height: (.8 * $(window).height()), minHeight:400, minWidth:680, width:680 }); //handle showing / hiding block items when a different category is selected $('.context-block-browser-categories', this.browser).change(function(e) { //if no category is selected we want to show all the items if ($(this).val() == 0) { $('.category', self.browser).show(); } else { $('.category', self.browser).hide(); $('.category-' + $(this).val(), self.browser).show(); } }); //if we already have the function for a different context, rebind it so we don't get dupes if(this.addToRegion) { $('.context-block-addable', this.browser).unbind('click.addToRegion') } //protected function for adding a clicked block to a region var self = this; this.addToRegion = function(e){ var ui = { 'item' : $(this).clone(), 'sender' : $(region) }; $(this).parents('.context-block-browser.active').dialog('close'); $(region).after(ui.item); self.addBlock(e, ui, this.editor, activeId.replace('context-editable-', '')); }; $('.context-block-addable', this.browser).bind('click.addToRegion', this.addToRegion); }, // Update UI to match the current block states. updateBlocks : function() { var browser = $('div.context-block-browser'); // For all enabled blocks, mark corresponding addables as having been added. $('.block, .admin-block').each(function() { var bid = $(this).attr('id').split('block-')[1]; // Ugh. }); // For all hidden addables with no corresponding blocks, mark as addable. $('.context-block-item', browser).each(function() { var bid = $(this).attr('id').split('context-block-addable-')[1]; }); // Mark empty regions. $(this.regions).each(function() { if ($('.block:has(a.context-block)', this).size() > 0) { $(this).removeClass('context-block-region-empty'); } else { $(this).addClass('context-block-region-empty'); } }); }, // Live update a region updateRegion : function(event, ui, region, op) { switch (op) { case 'over': $(region).removeClass('context-block-region-empty'); break; case 'out': if ( // jQuery UI 1.8 $('.draggable-placeholder', region).size() === 1 && $('.block:has(a.context-block)', region).size() == 0 ) { $(region).addClass('context-block-region-empty'); } break; } }, // Remove script elements while dragging & dropping. scriptFix : function(event, ui, editor, context) { if ($('script', ui.item)) { var placeholder = $(Drupal.settings.contextBlockEditor.scriptPlaceholder); var label = $('div.handle label', ui.item).text(); placeholder.children('strong').html(label); $('script', ui.item).parent().empty().append(placeholder); } }, // Add a block to a region through an AJAX load of the block contents. addBlock : function(event, ui, editor, context) { var self = this; if (ui.item.is('.context-block-addable')) { var bid = ui.item.attr('id').split('context-block-addable-')[1]; // Construct query params for our AJAX block request. var params = Drupal.settings.contextBlockEditor.params; params.context_block = bid + ',' + context; if (!Drupal.settings.contextBlockEditor.block_tokens || !Drupal.settings.contextBlockEditor.block_tokens[bid]) { alert(Drupal.t('An error occurred trying to retrieve block content. Please contact a site administer.')); return; } params.context_token = Drupal.settings.contextBlockEditor.block_tokens[bid]; // Replace item with loading block. //ui.sender.append(ui.item); var blockLoading = $('<div class="context-block-item context-block-loading"><span class="icon"></span></div>'); ui.item.addClass('context-block-added'); ui.item.after(blockLoading); $.getJSON(Drupal.settings.contextBlockEditor.path, params, function(data) { if (data.status) { var newBlock = $(data.block); if ($('script', newBlock)) { $('script', newBlock).remove(); } blockLoading.fadeOut(function() { $(this).replaceWith(newBlock); self.initBlocks(newBlock); self.updateBlocks(); Drupal.attachBehaviors(newBlock); }); } else { blockLoading.fadeOut(function() { $(this).remove(); }); } }); } else if (ui.item.is(':has(a.context-block)')) { self.updateBlocks(); } }, // Update form hidden field with JSON representation of current block visibility states. setState : function() { var self = this; $(this.regions).each(function() { var region = $('.context-block-region', this).attr('id').split('context-block-region-')[1]; var blocks = []; $('a.context-block', $(this)).each(function() { if ($(this).attr('class').indexOf('edit-') != -1) { var bid = $(this).attr('id').split('context-block-')[1]; var context = $(this).attr('class').split('edit-')[1].split(' ')[0]; context = context ? context : 0; var block = {'bid': bid, 'context': context}; blocks.push(block); } }); self.state[region] = blocks; }); // Serialize here and set form element value. $('input.context-block-editor-state', this.editor).val(JSON.stringify(this.state)); }, //Disable text selection. disableTextSelect : function() { if ($.browser.safari) { $('.block:has(a.context-block):not(:has(input,textarea))').css('WebkitUserSelect','none'); } else if ($.browser.mozilla) { $('.block:has(a.context-block):not(:has(input,textarea))').css('MozUserSelect','none'); } else if ($.browser.msie) { $('.block:has(a.context-block):not(:has(input,textarea))').bind('selectstart.contextBlockEditor', function() { return false; }); } else { $(this).bind('mousedown.contextBlockEditor', function() { return false; }); } }, //Enable text selection. enableTextSelect : function() { if ($.browser.safari) { $('*').css('WebkitUserSelect',''); } else if ($.browser.mozilla) { $('*').css('MozUserSelect',''); } else if ($.browser.msie) { $('*').unbind('selectstart.contextBlockEditor'); } else { $(this).unbind('mousedown.contextBlockEditor'); } }, // Start editing. Attach handlers, begin draggable/sortables. editStart : function(editor, context) { var self = this; // This is redundant to the start handler found in context_ui.js. // However it's necessary that we trigger this class addition before // we call .sortable() as the empty regions need to be visible. $(document.body).addClass('context-editing'); this.editor.addClass('context-editing'); this.disableTextSelect(); this.initBlocks($('.block:has(a.context-block.edit-'+context+')')); this.initRegions($('.context-block-region').parent()); this.updateBlocks(); $('a.context_ui_dialog-stop').hide(); $('.editing-context-label').remove(); var label = $('#context-editable-trigger-'+context+' .label').text(); label = Drupal.t('Now Editing: ') + label; editor.parent().parent() .prepend('<div class="editing-context-label">'+ label + '</div>'); // First pass, enable sortables on all regions. $(this.regions).each(function() { var region = $(this); var params = { revert: true, dropOnEmpty: true, placeholder: 'draggable-placeholder', forcePlaceholderSize: true, items: '> .block:has(a.context-block.editable)', handle: 'a.context-block-handle', start: function(event, ui) { self.scriptFix(event, ui, editor, context); }, stop: function(event, ui) { self.addBlock(event, ui, editor, context); }, receive: function(event, ui) { self.addBlock(event, ui, editor, context); }, over: function(event, ui) { self.updateRegion(event, ui, region, 'over'); }, out: function(event, ui) { self.updateRegion(event, ui, region, 'out'); }, cursorAt: {left: 300, top: 0} }; region.sortable(params); }); // Second pass, hook up all regions via connectWith to each other. $(this.regions).each(function() { $(this).sortable('option', 'connectWith', ['.ui-sortable']); }); // Terrible, terrible workaround for parentoffset issue in Safari. // The proper fix for this issue has been committed to jQuery UI, but was // not included in the 1.6 release. Therefore, we do a browser agent hack // to ensure that Safari users are covered by the offset fix found here: // http://dev.jqueryui.com/changeset/2073. if ($.ui.version === '1.6' && $.browser.safari) { $.browser.mozilla = true; } }, // Finish editing. Remove handlers. editFinish : function() { this.editor.removeClass('context-editing'); this.enableTextSelect(); $('.editing-context-label').remove(); // Remove UI elements. $(this.blocks).each(function() { $('a.context-block-handle, a.context-block-remove', this).remove(); if($(this).hasClass('context-block-empty')) { $(this).addClass('context-block-hidden'); } $(this).removeClass('draggable'); }); $('a.context_ui_dialog-stop').show(); this.regions.sortable('destroy'); this.setState(); // Unhack the user agent. if ($.ui.version === '1.6' && $.browser.safari) { $.browser.mozilla = false; } } }; //End of DrupalContextBlockEditor prototype })(jQuery);
JavaScript
(function($) { /** * Context plugin form. */ function DrupalContextPlugins(form) { this.form = form; // Sync the form selector and state field with the list of plugins currently enabled. this.setState = function() { var state = []; $('.context-plugin-list > li', this.form).each(function() { var plugin = $(this).attr('class').split('context-plugin-')[1].split(' ')[0]; if ($(this).is('.disabled')) { $('.context-plugin-selector select option[value='+plugin+']', this.form).show(); } else { state.push(plugin); $('.context-plugin-selector select option[value='+plugin+']', this.form).hide(); } }); // Set the hidden plugin list state. $('.context-plugin-selector input.context-plugins-state', this.form).val(state.join(',')); // Reset the selector. $('.context-plugin-selector select', this.form).val(0); return this; }; // Add a plugin to the list. this.addPlugin = function(plugin) { $('.context-plugin-list > li.context-plugin-'+plugin, this.form).removeClass('disabled'); this.showForm(plugin).setState(); return this; }; // Remove a plugin from the list. this.removePlugin = function(plugin) { $('.context-plugin-list > li.context-plugin-'+plugin, this.form).addClass('disabled'); this.hideForm(plugin).setState(); return this; }; // Show a plugin form. this.showForm = function(plugin) { $('.context-plugin-forms > .context-plugin-form.active-form', this.form).removeClass('active-form'); $('.context-plugin-forms > .context-plugin-form-'+plugin, this.form).addClass('active-form'); $('.context-plugin-list > li > a').removeClass('active-form'); $('.context-plugin-list > li.context-plugin-'+plugin+' > a').addClass('active-form'); return this; }; // Show a plugin form. this.hideForm = function(plugin) { $('.context-plugin-forms > .context-plugin-form-'+plugin, this.form).removeClass('active-form'); $('.context-plugin-list > li.context-plugin-'+plugin+' > a').removeClass('active-form'); return this; }; // Select handler. $('.context-plugin-selector select', this.form).change(function() { var plugins = $(this).parents('div.context-plugins').data('contextPlugins'); if (plugins) { var plugin = $(this).val(); plugins.addPlugin(plugin); } }); // Show form handler. $('.context-plugin-list > li > a', this.form).click(function() { var plugins = $(this).parents('div.context-plugins').data('contextPlugins'); if (plugins) { var plugin = $(this).attr('href').split('#context-plugin-form-')[1]; plugins.showForm(plugin); } return false; }); // Remove handler. $('.context-plugin-list span.remove', this.form).click(function() { var plugins = $(this).parents('div.context-plugins').data('contextPlugins'); if (plugins) { var plugin = $(this).parent().attr('href').split('#context-plugin-form-')[1]; plugins.removePlugin(plugin); } return false; }); // Set the plugin states. this.setState(); } Drupal.behaviors.context_ui = { attach: function(context) { // Initialize context plugin form. $('form div.context-plugins:not(.context-ui-processed)').each(function() { $(this).addClass('context-ui-processed'); $(this).data('contextPlugins', new DrupalContextPlugins($(this))); }); // Initialize context editor. if (jQuery().pageEditor) { $('form.context-editor:not(.context-ui-processed)') .addClass('context-ui-processed') .pageEditor() .each(function() { var editor = $(this); var defaultContext = $('li.context-editable', this).attr('id').split('context-editable-trigger-')[1]; $(this).data('defaultContext', defaultContext); // Attach start/end handlers to editable contexts. $('li.context-editable a.edit', editor).click(function() { var trigger = $(this).parents('li.context-editable').addClass('context-editing'); var context = trigger.attr('id').split('context-editable-trigger-')[1]; editor.pageEditor('start', context); return false; }); $('li.context-editable a.done', editor).click(function() { editor.pageEditor('end'); return false; }); $(editor).submit(function() { if (editor.pageEditor('isEditing')) { editor.pageEditor('end'); } }); // Handler for start event. editor.bind('start.pageEditor', function(event, context) { // Fallback to first context if param is empty. if (!context) { context = $(this).data('defaultContext'); $('li#context-editable-trigger-'+context, this).addClass('context-editing'); } $(document.body).addClass('context-editing'); $('#context-editable-'+context, this).show(); }); // Handler for end event. editor.bind('end.pageEditor', function(event, context) { $(document.body).removeClass('context-editing'); $('div.contexts div.context-editable', this).hide(); $('li.context-editable').removeClass('context-editing'); $('form.context-editor').addClass('edited'); }); }); } }}; })(jQuery);
JavaScript
/** * Generic pageEditor plugin. Allows an editor DOM object to trigger * init, start, and end events. Implementors can check whether the * editor is currently editing and bind handlers for the events triggered * by the editor. */ (function($) { $.fn.pageEditor = function(method, data) { this.each(function() { switch (method) { case 'isEditing': return this.editing; case 'start': if (!this.inited) { this.inited = true; $(this).trigger('init.pageEditor', data); } this.editing = true; $(this).trigger('start.pageEditor', data); break; case 'end': if (!this.inited) { this.inited = true; $(this).trigger('init.pageEditor', data); } this.editing = false; $(this).trigger('end.pageEditor', data); break; default: this.inited = false; this.editing = false; break; } }); return this; }; })(jQuery);
JavaScript
(function ($) { Drupal.behaviors.context_ui_dialog = { attach: function(context) { var selector = $('#context_ui_dialog-context-ui', context).not('context_ui_dialog-processed'); if(selector) { selector.addClass('context_ui_dialog-processed'); selector.detach(); $('#page').prepend(selector); var labelOpen = Drupal.t('Select Context'); var labelClose = Drupal.t('Hide'); // Create a tab to show/hide our edit area var tab = $('<a href="javascript:" class="context-ui-dialog-open" title="Show Context Selector">'+labelClose+'</a>'); selector.append(tab); selector.toggled = false; var width = $(selector).outerWidth(); tab.click(function(e){ if(selector.toggled) { selector.stop(true, false).animate({'left':0}, 400); selector.toggled = false; $(this).text(labelClose); } else { selector.stop(true, false).animate({'left':-width-4}, 400); selector.toggled = true; $(this).text(labelOpen); } }); $('#context_ui_dialog-context-ui').show(); // Make sure the UI is 60% of the size of the window var context_ui_height = Math.round(6 * $(window).height() / 10); var item_list_height = context_ui_height - 200; item_list_height = (item_list_height < 50) ? 50 : item_list_height; $('#context_ui_dialog-context-ui').height(context_ui_height); $('#context_ui_dialog-context-ui .item-list').height(item_list_height); // Add a class to body $('body').once().addClass('context-field-editor'); } } }; })(jQuery);
JavaScript
/** * create a simple search filter thing for a list */ (function ($) { Drupal.Filter = function (list, title, type, parent){ this.list = list; this.title = title; //provide defaults for type and parent so bad things don't happen if (!type) { var type = '*'; } this.type = type; if (!parent) { var parent = list; } this.parent = parent; this.init(); } Drupal.Filter.prototype = { init : function(){ this.wrapper = $('<div class="filter-wrapper"></div>'); if(this.title){ this.title = '<h3>' + this.title + '</h3>'; this.wrapper.append(this.title); } this.input = $('<input type="text" class="filter" />'); this.wrapper.append(this.input); $(this.parent).append(this.wrapper); this.createHandlers(); }, createHandlers : function(){ var self = this; $(this.input).keyup(function(e){ self.filter(); }); }, filter : function(){ //show all first off $('*', this.list).show(); //hide ignored items if(this.input.val()) { $('*', this.list).not(this.type).hide(); } var regex = new RegExp(this.input.val(), 'i'); var self = this; $(this.type, this.list).each(function(ind, el) { var string = self.strip(el.innerHTML); if(!regex.test(string)){ $(el).hide(); } else { //show the parent and any labels or whatever in the parent var parent = $(el).parent().show(); $('*', parent).not(self.type).show(); } }); }, strip : function(string){ var strip = /<([^<|^>]*)>/i; while(strip.test(string)){ var matches = string.match(strip); string = string.replace(strip, ''); } return string; } }; })(jQuery);
JavaScript
(function($) { Drupal.behaviors.contextLayoutsReactionBlock = {}; Drupal.behaviors.contextLayoutsReactionBlock.attach = function(context) { // ContextBlockForm: Init. $('.context-blockform-layout:not(.contextLayoutsProcessed)').each(function() { $(this).addClass('contextLayoutsProcessed'); $(this).change(function() { var layout = $(this).val(); if (Drupal.settings.contextLayouts.layouts[layout]) { $('#context-blockform td.blocks').find('table, div.label, div.tabledrag-toggle-weight-wrapper').hide(); for (var key in Drupal.settings.contextLayouts.layouts[layout]) { var region = Drupal.settings.contextLayouts.layouts[layout][key]; $('.context-blockform-regionlabel-'+region).show().next('div.tabledrag-toggle-weight-wrapper').show(); $('#context-blockform-region-'+region).show(); } if (Drupal.contextBlockForm) { Drupal.contextBlockForm.setState(); } } }); $(this).change(); }); }; })(jQuery);
JavaScript
/** * @file * CTools Bulk Export javascript functions. */ (function ($) { Drupal.behaviors.CToolsBulkExport = { attach: function (context) { $('#bulk-export-export-form .vertical-tabs-pane', context).drupalSetSummary(function (context) { // Check if any individual checkbox is checked. if ($('.bulk-selection input:checked', context).length > 0) { return Drupal.t('Exportables selected'); } return ''; }); // Special bind click on the select-all checkbox. $('.select-all').bind('click', function(context) { $(this, '.vertical-tabs-pane').drupalSetSummary(context); }); } }; })(jQuery);
JavaScript
/** * Provide the HTML to create the modal dialog. */ Drupal.theme.prototype.CToolsSampleModal = function () { var html = ''; html += '<div id="ctools-modal" class="popups-box">'; html += ' <div class="ctools-modal-content ctools-sample-modal-content">'; html += ' <table cellpadding="0" cellspacing="0" id="ctools-face-table">'; html += ' <tr>'; html += ' <td class="popups-tl popups-border"></td>'; html += ' <td class="popups-t popups-border"></td>'; html += ' <td class="popups-tr popups-border"></td>'; html += ' </tr>'; html += ' <tr>'; html += ' <td class="popups-cl popups-border"></td>'; html += ' <td class="popups-c" valign="top">'; html += ' <div class="popups-container">'; html += ' <div class="modal-header popups-title">'; html += ' <span id="modal-title" class="modal-title"></span>'; html += ' <span class="popups-close"><a class="close" href="#">' + Drupal.CTools.Modal.currentSettings.closeText + '</a></span>'; html += ' <div class="clear-block"></div>'; html += ' </div>'; html += ' <div class="modal-scroll"><div id="modal-content" class="modal-content popups-body"></div></div>'; html += ' <div class="popups-buttons"></div>'; //Maybe someday add the option for some specific buttons. html += ' <div class="popups-footer"></div>'; //Maybe someday add some footer. html += ' </div>'; html += ' </td>'; html += ' <td class="popups-cr popups-border"></td>'; html += ' </tr>'; html += ' <tr>'; html += ' <td class="popups-bl popups-border"></td>'; html += ' <td class="popups-b popups-border"></td>'; html += ' <td class="popups-br popups-border"></td>'; html += ' </tr>'; html += ' </table>'; html += ' </div>'; html += '</div>'; return html; }
JavaScript
/** * @file * * Implement a modal form. * * @see modal.inc for documentation. * * This javascript relies on the CTools ajax responder. */ (function ($) { // Make sure our objects are defined. Drupal.CTools = Drupal.CTools || {}; Drupal.CTools.Modal = Drupal.CTools.Modal || {}; /** * Display the modal * * @todo -- document the settings. */ Drupal.CTools.Modal.show = function(choice) { var opts = {}; if (choice && typeof choice == 'string' && Drupal.settings[choice]) { // This notation guarantees we are actually copying it. $.extend(true, opts, Drupal.settings[choice]); } else if (choice) { $.extend(true, opts, choice); } var defaults = { modalTheme: 'CToolsModalDialog', throbberTheme: 'CToolsModalThrobber', animation: 'show', animationSpeed: 'fast', modalSize: { type: 'scale', width: .8, height: .8, addWidth: 0, addHeight: 0, // How much to remove from the inner content to make space for the // theming. contentRight: 25, contentBottom: 45 }, modalOptions: { opacity: .55, background: '#fff' } }; var settings = {}; $.extend(true, settings, defaults, Drupal.settings.CToolsModal, opts); if (Drupal.CTools.Modal.currentSettings && Drupal.CTools.Modal.currentSettings != settings) { Drupal.CTools.Modal.modal.remove(); Drupal.CTools.Modal.modal = null; } Drupal.CTools.Modal.currentSettings = settings; var resize = function(e) { // When creating the modal, it actually exists only in a theoretical // place that is not in the DOM. But once the modal exists, it is in the // DOM so the context must be set appropriately. var context = e ? document : Drupal.CTools.Modal.modal; if (Drupal.CTools.Modal.currentSettings.modalSize.type == 'scale') { var width = $(window).width() * Drupal.CTools.Modal.currentSettings.modalSize.width; var height = $(window).height() * Drupal.CTools.Modal.currentSettings.modalSize.height; } else { var width = Drupal.CTools.Modal.currentSettings.modalSize.width; var height = Drupal.CTools.Modal.currentSettings.modalSize.height; } // Use the additionol pixels for creating the width and height. $('div.ctools-modal-content', context).css({ 'width': width + Drupal.CTools.Modal.currentSettings.modalSize.addWidth + 'px', 'height': height + Drupal.CTools.Modal.currentSettings.modalSize.addHeight + 'px' }); $('div.ctools-modal-content .modal-content', context).css({ 'width': (width - Drupal.CTools.Modal.currentSettings.modalSize.contentRight) + 'px', 'height': (height - Drupal.CTools.Modal.currentSettings.modalSize.contentBottom) + 'px' }); } if (!Drupal.CTools.Modal.modal) { Drupal.CTools.Modal.modal = $(Drupal.theme(settings.modalTheme)); if (settings.modalSize.type == 'scale') { $(window).bind('resize', resize); } } resize(); $('span.modal-title', Drupal.CTools.Modal.modal).html(Drupal.CTools.Modal.currentSettings.loadingText); Drupal.CTools.Modal.modalContent(Drupal.CTools.Modal.modal, settings.modalOptions, settings.animation, settings.animationSpeed); $('#modalContent .modal-content').html(Drupal.theme(settings.throbberTheme)); }; /** * Hide the modal */ Drupal.CTools.Modal.dismiss = function() { if (Drupal.CTools.Modal.modal) { Drupal.CTools.Modal.unmodalContent(Drupal.CTools.Modal.modal); } }; /** * Provide the HTML to create the modal dialog. */ Drupal.theme.prototype.CToolsModalDialog = function () { var html = '' html += ' <div id="ctools-modal">' html += ' <div class="ctools-modal-content">' // panels-modal-content html += ' <div class="modal-header">'; html += ' <a class="close" href="#">'; html += Drupal.CTools.Modal.currentSettings.closeText + Drupal.CTools.Modal.currentSettings.closeImage; html += ' </a>'; html += ' <span id="modal-title" class="modal-title">&nbsp;</span>'; html += ' </div>'; html += ' <div id="modal-content" class="modal-content">'; html += ' </div>'; html += ' </div>'; html += ' </div>'; return html; } /** * Provide the HTML to create the throbber. */ Drupal.theme.prototype.CToolsModalThrobber = function () { var html = ''; html += ' <div id="modal-throbber">'; html += ' <div class="modal-throbber-wrapper">'; html += Drupal.CTools.Modal.currentSettings.throbber; html += ' </div>'; html += ' </div>'; return html; }; /** * Figure out what settings string to use to display a modal. */ Drupal.CTools.Modal.getSettings = function (object) { var match = $(object).attr('class').match(/ctools-modal-(\S+)/); if (match) { return match[1]; } } /** * Click function for modals that can be cached. */ Drupal.CTools.Modal.clickAjaxCacheLink = function () { Drupal.CTools.Modal.show(Drupal.CTools.Modal.getSettings(this)); return Drupal.CTools.AJAX.clickAJAXCacheLink.apply(this); }; /** * Handler to prepare the modal for the response */ Drupal.CTools.Modal.clickAjaxLink = function () { Drupal.CTools.Modal.show(Drupal.CTools.Modal.getSettings(this)); return false; }; /** * Submit responder to do an AJAX submit on all modal forms. */ Drupal.CTools.Modal.submitAjaxForm = function(e) { var $form = $(this); var url = $form.attr('action'); setTimeout(function() { Drupal.CTools.AJAX.ajaxSubmit($form, url); }, 1); return false; } /** * Bind links that will open modals to the appropriate function. */ Drupal.behaviors.ZZCToolsModal = { attach: function(context) { // Bind links // Note that doing so in this order means that the two classes can be // used together safely. /* * @todo remimplement the warm caching feature $('a.ctools-use-modal-cache', context).once('ctools-use-modal', function() { $(this).click(Drupal.CTools.Modal.clickAjaxCacheLink); Drupal.CTools.AJAX.warmCache.apply(this); }); */ $('area.ctools-use-modal, a.ctools-use-modal', context).once('ctools-use-modal', function() { var $this = $(this); $this.click(Drupal.CTools.Modal.clickAjaxLink); // Create a drupal ajax object var element_settings = {}; if ($this.attr('href')) { element_settings.url = $this.attr('href'); element_settings.event = 'click'; element_settings.progress = { type: 'throbber' }; } var base = $this.attr('href'); Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings); }); // Bind buttons $('input.ctools-use-modal, button.ctools-use-modal', context).once('ctools-use-modal', function() { var $this = $(this); $this.click(Drupal.CTools.Modal.clickAjaxLink); var button = this; var element_settings = {}; // AJAX submits specified in this manner automatically submit to the // normal form action. element_settings.url = Drupal.CTools.Modal.findURL(this); element_settings.event = 'click'; var base = $this.attr('id'); Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings); // Make sure changes to settings are reflected in the URL. $('.' + $(button).attr('id') + '-url').change(function() { Drupal.ajax[base].options.url = Drupal.CTools.Modal.findURL(button); }); }); // Bind our custom event to the form submit $('#modal-content form', context).once('ctools-use-modal', function() { var $this = $(this); var element_settings = {}; element_settings.url = $this.attr('action'); element_settings.event = 'submit'; element_settings.progress = { 'type': 'throbber' } var base = $this.attr('id'); Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings); Drupal.ajax[base].form = $this; $('input[type=submit], button', this).click(function(event) { Drupal.ajax[base].element = this; this.form.clk = this; // An empty event means we were triggered via .click() and // in jquery 1.4 this won't trigger a submit. if (event.bubbles == undefined) { $(this.form).trigger('submit'); return false; } }); }); // Bind a click handler to allow elements with the 'ctools-close-modal' // class to close the modal. $('.ctools-close-modal', context).once('ctools-close-modal') .click(function() { Drupal.CTools.Modal.dismiss(); return false; }); } }; // The following are implementations of AJAX responder commands. /** * AJAX responder command to place HTML within the modal. */ Drupal.CTools.Modal.modal_display = function(ajax, response, status) { if ($('#modalContent').length == 0) { Drupal.CTools.Modal.show(Drupal.CTools.Modal.getSettings(ajax.element)); } $('#modal-title').html(response.title); // Simulate an actual page load by scrolling to the top after adding the // content. This is helpful for allowing users to see error messages at the // top of a form, etc. $('#modal-content').html(response.output).scrollTop(0); Drupal.attachBehaviors(); } /** * AJAX responder command to dismiss the modal. */ Drupal.CTools.Modal.modal_dismiss = function(command) { Drupal.CTools.Modal.dismiss(); $('link.ctools-temporary-css').remove(); } /** * Display loading */ //Drupal.CTools.AJAX.commands.modal_loading = function(command) { Drupal.CTools.Modal.modal_loading = function(command) { Drupal.CTools.Modal.modal_display({ output: Drupal.theme(Drupal.CTools.Modal.currentSettings.throbberTheme), title: Drupal.CTools.Modal.currentSettings.loadingText }); } /** * Find a URL for an AJAX button. * * The URL for this gadget will be composed of the values of items by * taking the ID of this item and adding -url and looking for that * class. They need to be in the form in order since we will * concat them all together using '/'. */ Drupal.CTools.Modal.findURL = function(item) { var url = ''; var url_class = '.' + $(item).attr('id') + '-url'; $(url_class).each( function() { var $this = $(this); if (url && $this.val()) { url += '/'; } url += $this.val(); }); return url; }; /** * modalContent * @param content string to display in the content box * @param css obj of css attributes * @param animation (fadeIn, slideDown, show) * @param speed (valid animation speeds slow, medium, fast or # in ms) */ Drupal.CTools.Modal.modalContent = function(content, css, animation, speed) { // If our animation isn't set, make it just show/pop if (!animation) { animation = 'show'; } else { // If our animation isn't "fadeIn" or "slideDown" then it always is show if (animation != 'fadeIn' && animation != 'slideDown') { animation = 'show'; } } if (!speed) { speed = 'fast'; } // Build our base attributes and allow them to be overriden css = jQuery.extend({ position: 'absolute', left: '0px', margin: '0px', background: '#000', opacity: '.55' }, css); // Add opacity handling for IE. css.filter = 'alpha(opacity=' + (100 * css.opacity) + ')'; content.hide(); // if we already ahve a modalContent, remove it if ( $('#modalBackdrop')) $('#modalBackdrop').remove(); if ( $('#modalContent')) $('#modalContent').remove(); // position code lifted from http://www.quirksmode.org/viewport/compatibility.html if (self.pageYOffset) { // all except Explorer var wt = self.pageYOffset; } else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict var wt = document.documentElement.scrollTop; } else if (document.body) { // all other Explorers var wt = document.body.scrollTop; } // Get our dimensions // Get the docHeight and (ugly hack) add 50 pixels to make sure we dont have a *visible* border below our div var docHeight = $(document).height() + 50; var docWidth = $(document).width(); var winHeight = $(window).height(); var winWidth = $(window).width(); if( docHeight < winHeight ) docHeight = winHeight; // Create our divs $('body').append('<div id="modalBackdrop" style="z-index: 1000; display: none;"></div><div id="modalContent" style="z-index: 1001; position: absolute;">' + $(content).html() + '</div>'); // Keyboard and focus event handler ensures focus stays on modal elements only modalEventHandler = function( event ) { target = null; if ( event ) { //Mozilla target = event.target; } else { //IE event = window.event; target = event.srcElement; } var parents = $(target).parents().get(); for (var i in $(target).parents().get()) { var position = $(parents[i]).css('position'); if (position == 'absolute' || position == 'fixed') { return true; } } if( $(target).filter('*:visible').parents('#modalContent').size()) { // allow the event only if target is a visible child node of #modalContent return true; } if ( $('#modalContent')) $('#modalContent').get(0).focus(); return false; }; $('body').bind( 'focus', modalEventHandler ); $('body').bind( 'keypress', modalEventHandler ); // Create our content div, get the dimensions, and hide it var modalContent = $('#modalContent').css('top','-1000px'); var mdcTop = wt + ( winHeight / 2 ) - ( modalContent.outerHeight() / 2); var mdcLeft = ( winWidth / 2 ) - ( modalContent.outerWidth() / 2); $('#modalBackdrop').css(css).css('top', 0).css('height', docHeight + 'px').css('width', docWidth + 'px').show(); modalContent.css({top: mdcTop + 'px', left: mdcLeft + 'px'}).hide()[animation](speed); // Bind a click for closing the modalContent modalContentClose = function(){close(); return false;}; $('.close').bind('click', modalContentClose); // Bind a keypress on escape for closing the modalContent modalEventEscapeCloseHandler = function(event) { if (event.keyCode == 27) { close(); return false; } }; $(document).bind('keypress', modalEventEscapeCloseHandler); // Close the open modal content and backdrop function close() { // Unbind the events $(window).unbind('resize', modalContentResize); $('body').unbind( 'focus', modalEventHandler); $('body').unbind( 'keypress', modalEventHandler ); $('.close').unbind('click', modalContentClose); $('body').unbind('keypress', modalEventEscapeCloseHandler); $(document).trigger('CToolsDetachBehaviors', $('#modalContent')); // Set our animation parameters and use them if ( animation == 'fadeIn' ) animation = 'fadeOut'; if ( animation == 'slideDown' ) animation = 'slideUp'; if ( animation == 'show' ) animation = 'hide'; // Close the content modalContent.hide()[animation](speed); // Remove the content $('#modalContent').remove(); $('#modalBackdrop').remove(); }; // Move and resize the modalBackdrop and modalContent on resize of the window modalContentResize = function(){ // Get our heights var docHeight = $(document).height(); var docWidth = $(document).width(); var winHeight = $(window).height(); var winWidth = $(window).width(); if( docHeight < winHeight ) docHeight = winHeight; // Get where we should move content to var modalContent = $('#modalContent'); var mdcTop = ( winHeight / 2 ) - ( modalContent.outerHeight() / 2); var mdcLeft = ( winWidth / 2 ) - ( modalContent.outerWidth() / 2); // Apply the changes $('#modalBackdrop').css('height', docHeight + 'px').css('width', docWidth + 'px').show(); modalContent.css('top', mdcTop + 'px').css('left', mdcLeft + 'px').show(); }; $(window).bind('resize', modalContentResize); $('#modalContent').focus(); }; /** * unmodalContent * @param content (The jQuery object to remove) * @param animation (fadeOut, slideUp, show) * @param speed (valid animation speeds slow, medium, fast or # in ms) */ Drupal.CTools.Modal.unmodalContent = function(content, animation, speed) { // If our animation isn't set, make it just show/pop if (!animation) { var animation = 'show'; } else { // If our animation isn't "fade" then it always is show if (( animation != 'fadeOut' ) && ( animation != 'slideUp')) animation = 'show'; } // Set a speed if we dont have one if ( !speed ) var speed = 'fast'; // Unbind the events we bound $(window).unbind('resize', modalContentResize); $('body').unbind('focus', modalEventHandler); $('body').unbind('keypress', modalEventHandler); $('.close').unbind('click', modalContentClose); $(document).trigger('CToolsDetachBehaviors', $('#modalContent')); // jQuery magic loop through the instances and run the animations or removal. content.each(function(){ if ( animation == 'fade' ) { $('#modalContent').fadeOut(speed, function() { $('#modalBackdrop').fadeOut(speed, function() { $(this).remove(); }); $(this).remove(); }); } else { if ( animation == 'slide' ) { $('#modalContent').slideUp(speed,function() { $('#modalBackdrop').slideUp(speed, function() { $(this).remove(); }); $(this).remove(); }); } else { $('#modalContent').remove(); $('#modalBackdrop').remove(); } } }); }; $(function() { Drupal.ajax.prototype.commands.modal_display = Drupal.CTools.Modal.modal_display; Drupal.ajax.prototype.commands.modal_dismiss = Drupal.CTools.Modal.modal_dismiss; }); })(jQuery);
JavaScript
/** * @file * * CTools flexible AJAX responder object. */ (function ($) { Drupal.CTools = Drupal.CTools || {}; Drupal.CTools.AJAX = Drupal.CTools.AJAX || {}; /** * Grab the response from the server and store it. * * @todo restore the warm cache functionality */ Drupal.CTools.AJAX.warmCache = function () { // Store this expression for a minor speed improvement. $this = $(this); var old_url = $this.attr('href'); // If we are currently fetching, or if we have fetched this already which is // ideal for things like pagers, where the previous page might already have // been seen in the cache. if ($this.hasClass('ctools-fetching') || Drupal.CTools.AJAX.commandCache[old_url]) { return false; } // Grab all the links that match this url and add the fetching class. // This allows the caching system to grab each url once and only once // instead of grabbing the url once per <a>. var $objects = $('a[href="' + old_url + '"]') $objects.addClass('ctools-fetching'); try { url = old_url.replace(/\/nojs(\/|$)/g, '/ajax$1'); $.ajax({ type: "POST", url: url, data: { 'js': 1, 'ctools_ajax': 1}, global: true, success: function (data) { Drupal.CTools.AJAX.commandCache[old_url] = data; $objects.addClass('ctools-cache-warmed').trigger('ctools-cache-warm', [data]); }, complete: function() { $objects.removeClass('ctools-fetching'); }, dataType: 'json' }); } catch (err) { $objects.removeClass('ctools-fetching'); return false; } return false; }; /** * Cachable click handler to fetch the commands out of the cache or from url. */ Drupal.CTools.AJAX.clickAJAXCacheLink = function () { $this = $(this); if ($this.hasClass('ctools-fetching')) { $this.bind('ctools-cache-warm', function (event, data) { Drupal.CTools.AJAX.respond(data); }); return false; } else { if ($this.hasClass('ctools-cache-warmed') && Drupal.CTools.AJAX.commandCache[$this.attr('href')]) { Drupal.CTools.AJAX.respond(Drupal.CTools.AJAX.commandCache[$this.attr('href')]); return false; } else { return Drupal.CTools.AJAX.clickAJAXLink.apply(this); } } }; /** * Find a URL for an AJAX button. * * The URL for this gadget will be composed of the values of items by * taking the ID of this item and adding -url and looking for that * class. They need to be in the form in order since we will * concat them all together using '/'. */ Drupal.CTools.AJAX.findURL = function(item) { var url = ''; var url_class = '.' + $(item).attr('id') + '-url'; $(url_class).each( function() { var $this = $(this); if (url && $this.val()) { url += '/'; } url += $this.val(); }); return url; }; // Hide these in a ready to ensure that Drupal.ajax is set up first. $(function() { Drupal.ajax.prototype.commands.attr = function(ajax, data, status) { $(data.selector).attr(data.name, data.value); }; Drupal.ajax.prototype.commands.redirect = function(ajax, data, status) { if (data.delay > 0) { setTimeout(function () { location.href = data.url; }, data.delay); } else { location.href = data.url; } }; Drupal.ajax.prototype.commands.reload = function(ajax, data, status) { location.reload(); }; Drupal.ajax.prototype.commands.submit = function(ajax, data, status) { $(data.selector).submit(); } }); })(jQuery);
JavaScript
// $Id$ /** * @file * Implement a simple, clickable dropbutton menu. * * See dropbutton.theme.inc for primary documentation. * * The javascript relies on four classes: * - The dropbutton must be fully contained in a div with the class * ctools-dropbutton. It must also contain the class ctools-no-js * which will be immediately removed by the javascript; this allows for * graceful degradation. * - The trigger that opens the dropbutton must be an a tag wit hthe class * ctools-dropbutton-link. The href should just be '#' as this will never * be allowed to complete. * - The part of the dropbutton that will appear when the link is clicked must * be a div with class ctools-dropbutton-container. * - Finally, ctools-dropbutton-hover will be placed on any link that is being * hovered over, so that the browser can restyle the links. * * This tool isn't meant to replace click-tips or anything, it is specifically * meant to work well presenting menus. */ (function ($) { Drupal.behaviors.CToolsDropbutton = { attach: function() { // Process buttons. All dropbuttons are buttons. $('.ctools-button') .once('ctools-button') .removeClass('ctools-no-js'); // Process dropbuttons. Not all buttons are dropbuttons. $('.ctools-dropbutton').once('ctools-dropbutton', function() { var $dropbutton = $(this); var $button = $('.ctools-content', $dropbutton); var $secondaryActions = $('li', $button).not(':first'); var $twisty = $(".ctools-link", $dropbutton); var open = false; var hovering = false; var timerID = 0; var toggle = function(close) { // if it's open or we're told to close it, close it. if (open || close) { // If we're just toggling it, close it immediately. if (!close) { open = false; $secondaryActions.slideUp(100); $dropbutton.removeClass('open'); } else { // If we were told to close it, wait half a second to make // sure that's what the user wanted. // Clear any previous timer we were using. if (timerID) { clearTimeout(timerID); } timerID = setTimeout(function() { if (!hovering) { open = false; $secondaryActions.slideUp(100); $dropbutton.removeClass('open'); }}, 500); } } else { // open it. open = true; $secondaryActions.animate({height: "show", opacity: "show"}, 100); $dropbutton.addClass('open'); } } // Hide the secondary actions initially. $secondaryActions.hide(); $twisty.click(function() { toggle(); return false; }); $dropbutton.hover( function() { hovering = true; }, // hover in function() { // hover out hovering = false; toggle(true); return false; } ); }); } } })(jQuery);
JavaScript
/** * @file * Implement a simple, clickable dropdown menu. * * See dropdown.theme.inc for primary documentation. * * The javascript relies on four classes: * - The dropdown must be fully contained in a div with the class * ctools-dropdown. It must also contain the class ctools-dropdown-no-js * which will be immediately removed by the javascript; this allows for * graceful degradation. * - The trigger that opens the dropdown must be an a tag wit hthe class * ctools-dropdown-link. The href should just be '#' as this will never * be allowed to complete. * - The part of the dropdown that will appear when the link is clicked must * be a div with class ctools-dropdown-container. * - Finally, ctools-dropdown-hover will be placed on any link that is being * hovered over, so that the browser can restyle the links. * * This tool isn't meant to replace click-tips or anything, it is specifically * meant to work well presenting menus. */ (function ($) { Drupal.behaviors.CToolsDropdown = { attach: function() { $('div.ctools-dropdown').once('ctools-dropdown', function() { var $dropdown = $(this); var open = false; var hovering = false; var timerID = 0; $dropdown.removeClass('ctools-dropdown-no-js'); var toggle = function(close) { // if it's open or we're told to close it, close it. if (open || close) { // If we're just toggling it, close it immediately. if (!close) { open = false; $("div.ctools-dropdown-container", $dropdown).slideUp(100); } else { // If we were told to close it, wait half a second to make // sure that's what the user wanted. // Clear any previous timer we were using. if (timerID) { clearTimeout(timerID); } timerID = setTimeout(function() { if (!hovering) { open = false; $("div.ctools-dropdown-container", $dropdown).slideUp(100); } }, 500); } } else { // open it. open = true; $("div.ctools-dropdown-container", $dropdown) .animate({height: "show", opacity: "show"}, 100); } } $("a.ctools-dropdown-link", $dropdown).click(function() { toggle(); return false; }); $dropdown.hover( function() { hovering = true; }, // hover in function() { // hover out hovering = false; toggle(true); return false; }); // @todo -- just use CSS for this noise. $("div.ctools-dropdown-container a").hover( function() { $(this).addClass('ctools-dropdown-hover'); }, function() { $(this).removeClass('ctools-dropdown-hover'); } ); }); } } })(jQuery);
JavaScript
/** * @file * Provides dependent visibility for form items in CTools' ajax forms. * * To your $form item definition add: * - '#process' => array('ctools_process_dependency'), * - '#dependency' => array('id-of-form-item' => array(list, of, values, that, * make, this, item, show), * * Special considerations: * - Radios are harder. Because Drupal doesn't give radio groups individual IDs, * use 'radio:name-of-radio'. * * - Checkboxes don't have their own id, so you need to add one in a div * around the checkboxes via #prefix and #suffix. You actually need to add TWO * divs because it's the parent that gets hidden. Also be sure to retain the * 'expand_checkboxes' in the #process array, because the CTools process will * override it. */ (function ($) { Drupal.CTools = Drupal.CTools || {}; Drupal.CTools.dependent = {}; Drupal.CTools.dependent.bindings = {}; Drupal.CTools.dependent.activeBindings = {}; Drupal.CTools.dependent.activeTriggers = []; Drupal.CTools.dependent.inArray = function(array, search_term) { var i = array.length; while (i--) { if (array[i] == search_term) { return true; } } return false; } Drupal.CTools.dependent.autoAttach = function() { // Clear active bindings and triggers. for (i in Drupal.CTools.dependent.activeTriggers) { $(Drupal.CTools.dependent.activeTriggers[i]).unbind('change'); } Drupal.CTools.dependent.activeTriggers = []; Drupal.CTools.dependent.activeBindings = {}; Drupal.CTools.dependent.bindings = {}; if (!Drupal.settings.CTools) { return; } // Iterate through all relationships for (id in Drupal.settings.CTools.dependent) { // Test to make sure the id even exists; this helps clean up multiple // AJAX calls with multiple forms. // Drupal.CTools.dependent.activeBindings[id] is a boolean, // whether the binding is active or not. Defaults to no. Drupal.CTools.dependent.activeBindings[id] = 0; // Iterate through all possible values for(bind_id in Drupal.settings.CTools.dependent[id].values) { // This creates a backward relationship. The bind_id is the ID // of the element which needs to change in order for the id to hide or become shown. // The id is the ID of the item which will be conditionally hidden or shown. // Here we're setting the bindings for the bind // id to be an empty array if it doesn't already have bindings to it if (!Drupal.CTools.dependent.bindings[bind_id]) { Drupal.CTools.dependent.bindings[bind_id] = []; } // Add this ID Drupal.CTools.dependent.bindings[bind_id].push(id); // Big long if statement. // Drupal.settings.CTools.dependent[id].values[bind_id] holds the possible values if (bind_id.substring(0, 6) == 'radio:') { var trigger_id = "input[name='" + bind_id.substring(6) + "']"; } else { var trigger_id = '#' + bind_id; } Drupal.CTools.dependent.activeTriggers.push(trigger_id); if ($(trigger_id).attr('type') == 'checkbox') { $(trigger_id).siblings('label').addClass('hidden-options'); } var getValue = function(item, trigger) { if ($(trigger).size() == 0) { return null; } if (item.substring(0, 6) == 'radio:') { var val = $(trigger + ':checked').val(); } else { switch ($(trigger).attr('type')) { case 'checkbox': var val = $(trigger).attr('checked') || 0; if (val) { $(trigger).siblings('label').removeClass('hidden-options').addClass('expanded-options'); } else { $(trigger).siblings('label').removeClass('expanded-options').addClass('hidden-options'); } break; default: var val = $(trigger).val(); } } return val; } var setChangeTrigger = function(trigger_id, bind_id) { // Triggered when change() is clicked. var changeTrigger = function() { var val = getValue(bind_id, trigger_id); if (val == null) { return; } for (i in Drupal.CTools.dependent.bindings[bind_id]) { var id = Drupal.CTools.dependent.bindings[bind_id][i]; // Fix numerous errors if (typeof id != 'string') { continue; } // This bit had to be rewritten a bit because two properties on the // same set caused the counter to go up and up and up. if (!Drupal.CTools.dependent.activeBindings[id]) { Drupal.CTools.dependent.activeBindings[id] = {}; } if (val != null && Drupal.CTools.dependent.inArray(Drupal.settings.CTools.dependent[id].values[bind_id], val)) { Drupal.CTools.dependent.activeBindings[id][bind_id] = 'bind'; } else { delete Drupal.CTools.dependent.activeBindings[id][bind_id]; } var len = 0; for (i in Drupal.CTools.dependent.activeBindings[id]) { len++; } var object = $('#' + id + '-wrapper'); if (!object.size()) { // Some elements can't use the parent() method or they can // damage things. They are guaranteed to have wrappers but // only if dependent.inc provided them. This check prevents // problems when multiple AJAX calls cause settings to build // up. var $original = $('#' + id); if ($original.is('fieldset') || $original.is('textarea')) { continue; } object = $('#' + id).parent(); } if (Drupal.settings.CTools.dependent[id].type == 'disable') { if (Drupal.settings.CTools.dependent[id].num <= len) { // Show if the element if criteria is matched object.attr('disabled', false); object.addClass('dependent-options'); object.children().attr('disabled', false); } else { // Otherwise hide. Use css rather than hide() because hide() // does not work if the item is already hidden, for example, // in a collapsed fieldset. object.attr('disabled', true); object.children().attr('disabled', true); } } else { if (Drupal.settings.CTools.dependent[id].num <= len) { // Show if the element if criteria is matched object.show(0); object.addClass('dependent-options'); } else { // Otherwise hide. Use css rather than hide() because hide() // does not work if the item is already hidden, for example, // in a collapsed fieldset. object.css('display', 'none'); } } } } $(trigger_id).change(function() { // Trigger the internal change function // the attr('id') is used because closures are more confusing changeTrigger(trigger_id, bind_id); }); // Trigger initial reaction changeTrigger(trigger_id, bind_id); } setChangeTrigger(trigger_id, bind_id); } } } Drupal.behaviors.CToolsDependent = { attach: function (context) { Drupal.CTools.dependent.autoAttach(); // Really large sets of fields are too slow with the above method, so this // is a sort of hacked one that's faster but much less flexible. $("select.ctools-master-dependent") .once('ctools-dependent') .change(function() { var val = $(this).val(); if (val == 'all') { $('.ctools-dependent-all').show(0); } else { $('.ctools-dependent-all').hide(0); $('.ctools-dependent-' + val).show(0); } }) .trigger('change'); } } })(jQuery);
JavaScript
(function($) { Drupal.behaviors.CToolsJumpMenu = { attach: function(context) { $('.ctools-jump-menu-hide') .once('ctools-jump-menu') .hide(); $('.ctools-jump-menu-change') .once('ctools-jump-menu') .change(function() { var loc = $(this).val(); var urlArray = loc.split('::'); if (urlArray[1]) { location.href = urlArray[1]; } else { location.href = loc; } return false; }); $('.ctools-jump-menu-button') .once('ctools-jump-menu') .click(function() { // Instead of submitting the form, just perform the redirect. // Find our sibling value. var $select = $(this).parents('form').find('.ctools-jump-menu-select'); var loc = $select.val(); var urlArray = loc.split('::'); if (urlArray[1]) { location.href = urlArray[1]; } else { location.href = loc; } return false; }); } } })(jQuery);
JavaScript
(function ($) { Drupal.CTools = Drupal.CTools || {}; Drupal.CTools.Stylizer = {}; Drupal.CTools.Stylizer.addFarbtastic = function(context) { // This behavior attaches by ID, so is only valid once on a page. if ($('ctools_stylizer_color_scheme_form .color-form.Stylizer-processed').size()) { return; } var form = $('.color-form', context); var inputs = []; var hooks = []; var locks = []; var focused = null; // Add Farbtastic $(form).prepend('<div id="placeholder"></div>').addClass('color-processed'); var farb = $.farbtastic('#placeholder'); // Decode reference colors to HSL /*var reference = Drupal.settings.Stylizer.reference.clone(); for (i in reference) { reference[i] = farb.RGBToHSL(farb.unpack(reference[i])); } */ // Set up colorscheme selector $('#edit-scheme', form).change(function () { var colors = this.options[this.selectedIndex].value; if (colors != '') { colors = colors.split(','); for (i in colors) { callback(inputs[i], colors[i], false, true); } } }); /** * Shift a given color, using a reference pair (ref in HSL). * * This algorithm ensures relative ordering on the saturation and luminance * axes is preserved, and performs a simple hue shift. * * It is also symmetrical. If: shift_color(c, a, b) == d, * then shift_color(d, b, a) == c. */ function shift_color(given, ref1, ref2) { // Convert to HSL given = farb.RGBToHSL(farb.unpack(given)); // Hue: apply delta given[0] += ref2[0] - ref1[0]; // Saturation: interpolate if (ref1[1] == 0 || ref2[1] == 0) { given[1] = ref2[1]; } else { var d = ref1[1] / ref2[1]; if (d > 1) { given[1] /= d; } else { given[1] = 1 - (1 - given[1]) * d; } } // Luminance: interpolate if (ref1[2] == 0 || ref2[2] == 0) { given[2] = ref2[2]; } else { var d = ref1[2] / ref2[2]; if (d > 1) { given[2] /= d; } else { given[2] = 1 - (1 - given[2]) * d; } } return farb.pack(farb.HSLToRGB(given)); } /** * Callback for Farbtastic when a new color is chosen. */ function callback(input, color, propagate, colorscheme) { // Set background/foreground color $(input).css({ backgroundColor: color, 'color': farb.RGBToHSL(farb.unpack(color))[2] > 0.5 ? '#000' : '#fff' }); // Change input value if (input.value && input.value != color) { input.value = color; // Update locked values if (propagate) { var i = input.i; for (j = i + 1; ; ++j) { if (!locks[j - 1] || $(locks[j - 1]).is('.unlocked')) break; var matched = shift_color(color, reference[input.key], reference[inputs[j].key]); callback(inputs[j], matched, false); } for (j = i - 1; ; --j) { if (!locks[j] || $(locks[j]).is('.unlocked')) break; var matched = shift_color(color, reference[input.key], reference[inputs[j].key]); callback(inputs[j], matched, false); } } // Reset colorscheme selector if (!colorscheme) { resetScheme(); } } } /** * Reset the color scheme selector. */ function resetScheme() { $('#edit-scheme', form).each(function () { this.selectedIndex = this.options.length - 1; }); } // Focus the Farbtastic on a particular field. function focus() { var input = this; // Remove old bindings focused && $(focused).unbind('keyup', farb.updateValue) .unbind('keyup', resetScheme) .parent().removeClass('item-selected'); // Add new bindings focused = this; farb.linkTo(function (color) { callback(input, color, true, false); }); farb.setColor(this.value); $(focused).keyup(farb.updateValue).keyup(resetScheme) .parent().addClass('item-selected'); } // Initialize color fields $('#palette input.form-text', form) .each(function () { // Extract palette field name this.key = this.id.substring(13); // Link to color picker temporarily to initialize. farb.linkTo(function () {}).setColor('#000').linkTo(this); // Add lock var i = inputs.length; if (inputs.length) { var lock = $('<div class="lock"></div>').toggle( function () { $(this).addClass('unlocked'); $(hooks[i - 1]).attr('class', locks[i - 2] && $(locks[i - 2]).is(':not(.unlocked)') ? 'hook up' : 'hook' ); $(hooks[i]).attr('class', locks[i] && $(locks[i]).is(':not(.unlocked)') ? 'hook down' : 'hook' ); }, function () { $(this).removeClass('unlocked'); $(hooks[i - 1]).attr('class', locks[i - 2] && $(locks[i - 2]).is(':not(.unlocked)') ? 'hook both' : 'hook down' ); $(hooks[i]).attr('class', locks[i] && $(locks[i]).is(':not(.unlocked)') ? 'hook both' : 'hook up' ); } ); $(this).after(lock); locks.push(lock); }; // Add hook var $this = $(this); var hook = $('<div class="hook"></div>'); $this.after(hook); hooks.push(hook); $this.parent().find('.lock').click(); this.i = i; inputs.push(this); }) .focus(focus); $('#palette label', form); // Focus first color focus.call(inputs[0]); }; Drupal.behaviors.CToolsColorSettings = { attach: function() { $('.ctools-stylizer-color-edit:not(.ctools-color-processed)') .addClass('ctools-color-processed') .each(function() { Drupal.CTools.Stylizer.addFarbtastic('#' + $(this).attr('id')); }); $('div.form-item div.ctools-style-icon:not(.ctools-color-processed)') .addClass('ctools-color-processed') .click(function() { $widget = $('input', $(this).parent()); // Toggle if a checkbox, turn on if a radio. $widget.attr('checked', !$widget.attr('checked') || $widget.is('input[type=radio]')); }); } } })(jQuery);
JavaScript
(function($){ /** * To make a form auto submit, all you have to do is 3 things: * * ctools_add_js('auto-submit'); * * On gadgets you want to auto-submit when changed, add the ctools-auto-submit * class. With FAPI, add: * @code * '#attributes' => array('class' => array('ctools-auto-submit')), * @endcode * * If you want to have auto-submit for every form element, * add the ctools-auto-submit-full-form to the form. With FAPI, add: * @code * '#attributes' => array('class' => array('ctools-auto-submit-full-form')), * @endcode * * If you want to exclude a field from the ctool-auto-submit-full-form auto submission, * add the class ctools-auto-submit-exclude to the form element. With FAPI, add: * @code * '#attributes' => array('class' => array('ctools-auto-submit-exclude')), * @endcode * * Finally, you have to identify which button you want clicked for autosubmit. * The behavior of this button will be honored if it's ajaxy or not: * @code * '#attributes' => array('class' => array('ctools-use-ajax', 'ctools-auto-submit-click')), * @endcode * * Currently only 'select', 'radio', 'checkbox' and 'textfield' types are supported. We probably * could use additional support for HTML5 input types. */ Drupal.behaviors.CToolsAutoSubmit = { attach: function(context) { // 'this' references the form element function triggerSubmit (e) { var $this = $(this); if (!$this.hasClass('ctools-ajaxing')) { $this.find('.ctools-auto-submit-click').click(); } } // the change event bubbles so we only need to bind it to the outer form $('form.ctools-auto-submit-full-form', context) .add('.ctools-auto-submit', context) .filter('form, select, input:not(:text, :submit, .ctools-auto-submit-exclude)') .once('ctools-auto-submit') .change(function (e) { // don't trigger on text change for full-form if ($(e.target).is(':not(:text, :submit)')) { triggerSubmit.call(e.target.form); } }); // e.keyCode: key var discardKeyCode = [ 16, // shift 17, // ctrl 18, // alt 20, // caps lock 33, // page up 34, // page down 35, // end 36, // home 37, // left arrow 38, // up arrow 39, // right arrow 40, // down arrow 9, // tab 13, // enter 27 // esc ]; // Don't wait for change event on textfields $('.ctools-auto-submit-full-form input:text, input:text.ctools-auto-submit', context) .filter(':not(.ctools-auto-submit-exclude)') .once('ctools-auto-submit', function () { // each textinput element has his own timeout var timeoutID = 0; $(this) .bind('keydown keyup', function (e) { if ($.inArray(e.keyCode, discardKeyCode) === -1) { timeoutID && clearTimeout(timeoutID); } }) .keyup(function(e) { if ($.inArray(e.keyCode, discardKeyCode) === -1) { timeoutID = setTimeout($.proxy(triggerSubmit, this.form), 500); } }); }); } } })(jQuery);
JavaScript
/** * @file * Javascript required for a simple collapsible div. * * Creating a collapsible div with this doesn't take too much. There are * three classes necessary: * * - ctools-collapsible-container: This is the overall container that will be * collapsible. This must be a div. * - ctools-collapsible-handle: This is the title area, and is what will be * visible when it is collapsed. This can be any block element, such as div * or h2. * - ctools-collapsible-content: This is the ocntent area and will only be * visible when expanded. This must be a div. * * Adding 'ctools-collapsible-remember' to the container class will cause the * state of the container to be stored in a cookie, and remembered from page * load to page load. This will only work if the container has a unique ID, so * very carefully add IDs to your containers. * * If the class 'ctools-no-container' is placed on the container, the container * will be the handle. The content will be found by appending '-content' to the * id of the handle. The ctools-collapsible-handle and * ctools-collapsible-content classes will not be required in that case, and no * restrictions on what of data the container is are placed. Like * ctools-collapsible-remember this requires an id to eist. * * The content will be 'open' unless the container class has 'ctools-collapsed' * as a class, which will cause the container to draw collapsed. */ (function ($) { // All CTools tools begin with this if they need to use the CTools namespace. if (!Drupal.CTools) { Drupal.CTools = {}; } /** * Object to store state. * * This object will remember the state of collapsible containers. The first * time a state is requested, it will check the cookie and set up the variable. * If a state has been changed, when the window is unloaded the state will be * saved. */ Drupal.CTools.Collapsible = { state: {}, stateLoaded: false, stateChanged: false, cookieString: 'ctools-collapsible-state=', /** * Get the current collapsed state of a container. * * If set to 1, the container is open. If set to -1, the container is * collapsed. If unset the state is unknown, and the default state should * be used. */ getState: function (id) { if (!this.stateLoaded) { this.loadCookie(); } return this.state[id]; }, /** * Set the collapsed state of a container for subsequent page loads. * * Set the state to 1 for open, -1 for collapsed. */ setState: function (id, state) { if (!this.stateLoaded) { this.loadCookie(); } this.state[id] = state; if (!this.stateChanged) { this.stateChanged = true; $(window).unload(this.unload); } }, /** * Check the cookie and load the state variable. */ loadCookie: function () { // If there is a previous instance of this cookie if (document.cookie.length > 0) { // Get the number of characters that have the list of values // from our string index. offset = document.cookie.indexOf(this.cookieString); // If its positive, there is a list! if (offset != -1) { offset += this.cookieString.length; var end = document.cookie.indexOf(';', offset); if (end == -1) { end = document.cookie.length; } // Get a list of all values that are saved on our string var cookie = unescape(document.cookie.substring(offset, end)); if (cookie != '') { var cookieList = cookie.split(','); for (var i = 0; i < cookieList.length; i++) { var info = cookieList[i].split(':'); this.state[info[0]] = info[1]; } } } } this.stateLoaded = true; }, /** * Turn the state variable into a string and store it in the cookie. */ storeCookie: function () { var cookie = ''; // Get a list of IDs, saparated by comma for (i in this.state) { if (cookie != '') { cookie += ','; } cookie += i + ':' + this.state[i]; } // Save this values on the cookie document.cookie = this.cookieString + escape(cookie) + ';path=/'; }, /** * Respond to the unload event by storing the current state. */ unload: function() { Drupal.CTools.Collapsible.storeCookie(); } }; // Set up an array for callbacks. Drupal.CTools.CollapsibleCallbacks = []; Drupal.CTools.CollapsibleCallbacksAfterToggle = []; /** * Bind collapsible behavior to a given container. */ Drupal.CTools.bindCollapsible = function () { var $container = $(this); // Allow the specification of the 'no container' class, which means the // handle and the container can be completely independent. if ($container.hasClass('ctools-no-container') && $container.attr('id')) { // In this case, the container *is* the handle and the content is found // by adding '-content' to the id. Obviously, an id is required. var handle = $container; var content = $('#' + $container.attr('id') + '-content'); } else { var handle = $container.children('.ctools-collapsible-handle'); var content = $container.children('div.ctools-collapsible-content'); } if (content.length) { // Create the toggle item and place it in front of the toggle. var toggle = $('<span class="ctools-toggle"></span>'); handle.before(toggle); // If the remember class is set, check to see if we have a remembered // state stored. if ($container.hasClass('ctools-collapsible-remember') && $container.attr('id')) { var state = Drupal.CTools.Collapsible.getState($container.attr('id')); if (state == 1) { $container.removeClass('ctools-collapsed'); } else if (state == -1) { $container.addClass('ctools-collapsed'); } } // If we should start collapsed, do so: if ($container.hasClass('ctools-collapsed')) { toggle.toggleClass('ctools-toggle-collapsed'); content.hide(); } var afterToggle = function () { if (Drupal.CTools.CollapsibleCallbacksAfterToggle) { for (i in Drupal.CTools.CollapsibleCallbacksAfterToggle) { Drupal.CTools.CollapsibleCallbacksAfterToggle[i]($container, handle, content, toggle); } } } var clickMe = function () { if (Drupal.CTools.CollapsibleCallbacks) { for (i in Drupal.CTools.CollapsibleCallbacks) { Drupal.CTools.CollapsibleCallbacks[i]($container, handle, content, toggle); } } // If the container is a table element slideToggle does not do what // we want, so use toggle() instead. if ($container.is('table')) { content.toggle(0, afterToggle); } else { content.slideToggle(100, afterToggle); } toggle.toggleClass('ctools-toggle-collapsed'); // If we're supposed to remember the state of this class, do so. if ($container.hasClass('ctools-collapsible-remember') && $container.attr('id')) { var state = toggle.hasClass('ctools-toggle-collapsed') ? -1 : 1; Drupal.CTools.Collapsible.setState($container.attr('id'), state); } return false; } // Let both the toggle and the handle be clickable. toggle.click(clickMe); handle.click(clickMe); } }; /** * Support Drupal's 'behaviors' system for binding. */ Drupal.behaviors.CToolsCollapsible = { attach: function(context) { $('.ctools-collapsible-container', context).once('ctools-collapsible', Drupal.CTools.bindCollapsible); } } })(jQuery);
JavaScript
/** * Provide some extra responses for the page list so we can have automatic * on change. */ Drupal.behaviors.PageManagerList = function() { var timeoutID = 0; $('form#page-manager-list-pages-form select:not(.pm-processed)') .addClass('pm-processed') .change(function() { $('#edit-pages-apply').click(); }); $('form#page-manager-list-pages-form input[type=text]:not(.pm-processed)') .addClass('pm-processed') .keyup(function(e) { switch (e.keyCode) { case 16: // shift case 17: // ctrl case 18: // alt case 20: // caps lock case 33: // page up case 34: // page down case 35: // end case 36: // home case 37: // left arrow case 38: // up arrow case 39: // right arrow case 40: // down arrow case 9: // tab case 13: // enter case 27: // esc return false; default: if (!$('#edit-pages-apply').hasClass('ctools-ajaxing')) { if ((timeoutID)) { clearTimeout(timeoutID); } timeoutID = setTimeout(function() { $('#edit-pages-apply').click(); }, 300); } } }); }
JavaScript
(function ($) { Drupal.behaviors.metatagUIConfigListing = { attach: function (context) { // Hide elements to be visible if JavaScript is enabled. $('.js-show').show(); // Make the leaf arrow clickable. $('.metatag-config-label').hover(function(){ $(this).css({'cursor':'pointer'}); }) .click(function(){ $(this).find('a.toggle-details', context).trigger('click'); }); // Show or hide the summary $('table.metatag-config-overview a.toggle-details', context).click(function(event) { $(this).parent('div').siblings('div.metatag-config-details').each(function() { if ($(this).hasClass('js-hide')) { $(this).slideDown('slow').removeClass('js-hide'); } else { $(this).slideUp('slow').addClass('js-hide'); } }); // Change the expanded or collapsed state of the instance label. if ($(this).parent('div').hasClass('collapsed')) { $(this).parent('div').removeClass('collapsed').addClass('expanded'); } else { $(this).parent('div').removeClass('expanded').addClass('collapsed'); } // This event may be triggered by a parent element click - so we don't // want the click to bubble up otherwise we get recursive click events. event.stopPropagation(); }); } } })(jQuery);
JavaScript
(function ($) { Drupal.behaviors.metatagFieldsetSummaries = { attach: function (context) { $('fieldset.metatags-form', context).drupalSetSummary(function (context) { var vals = []; $("input[type='text'], select, textarea", context).each(function() { var default_name = $(this).attr('name').replace(/\[value\]/, '[default]'); var default_value = $("input[type='hidden'][name='" + default_name + "']", context); if (default_value.length && default_value.val() == $(this).val()) { // Meta tag has a default value and form value matches default value. return true; } else if (!default_value.length && !$(this).val().length) { // Meta tag has no default value and form value is empty. return true; } var label = $("label[for='" + $(this).attr('id') + "']").text(); vals.push(Drupal.t('@label: @value', { '@label': $.trim(label), '@value': Drupal.truncate($(this).val(), 25) || Drupal.t('None') })); }); if (vals.length === 0) { return Drupal.t('Using defaults'); } else { return vals.join('<br />'); } }); } }; /** * Encode special characters in a plain-text string for display as HTML. */ Drupal.truncate = function (str, limit) { if (str.length > limit) { return str.substr(0, limit) + '...'; } else { return str; } }; })(jQuery);
JavaScript
(function ($) { Drupal.behaviors.pathFieldsetSummaries = { attach: function (context) { $('fieldset.path-form', context).drupalSetSummary(function (context) { var path = $('.form-item-path-alias input').val(); var automatic = $('.form-item-path-pathauto input').attr('checked'); if (automatic) { return Drupal.t('Automatic alias'); } if (path) { return Drupal.t('Alias: @alias', { '@alias': path }); } else { return Drupal.t('No alias'); } }); } }; })(jQuery);
JavaScript
/** * @file * Test JavaScript file for Libraries loading. * * Replace the text in the 'libraries-test-javascript' div. See README.txt for * more information. */ (function ($) { Drupal.behaviors.librariesTest = { attach: function(context, settings) { $('.libraries-test-javascript').text('If this text shows up, example_3.js was loaded successfully.') } }; })(jQuery);
JavaScript
/** * @file * Test JavaScript file for Libraries loading. * * Replace the text in the 'libraries-test-javascript' div. See README.txt for * more information. */ (function ($) { Drupal.behaviors.librariesTest = { attach: function(context, settings) { $('.libraries-test-javascript').text('If this text shows up, example_2.js was loaded successfully.') } }; })(jQuery);
JavaScript
/** * @file * Test JavaScript file for Libraries loading. * * Replace the text in the 'libraries-test-javascript' div. See README.txt for * more information. */ (function ($) { Drupal.behaviors.librariesTest = { attach: function(context, settings) { $('.libraries-test-javascript').text('If this text shows up, example_4.js was loaded successfully.') } }; })(jQuery);
JavaScript
/** * @file * Test JavaScript file for Libraries loading. * * Replace the text in the 'libraries-test-javascript' div. See README.txt for * more information. */ (function ($) { Drupal.behaviors.librariesTest = { attach: function(context, settings) { $('.libraries-test-javascript').text('If this text shows up, example_1.js was loaded successfully.') } }; })(jQuery);
JavaScript
/** * @file * Test JavaScript file for Libraries loading. * * Replace the text in the 'libraries-test-javascript' div. See README.txt for * more information. */ (function ($) { Drupal.behaviors.librariesTest = { attach: function(context, settings) { $('.libraries-test-javascript').text('If this text shows up, libraries_test.js was loaded successfully.') } }; })(jQuery);
JavaScript
(function ($) { /** * Webform node form interface enhancments. */ Drupal.behaviors.webformAdmin = {}; Drupal.behaviors.webformAdmin.attach = function(context) { // Apply special behaviors to fields with default values. Drupal.webform.defaultValues(context); // On click or change, make a parent radio button selected. Drupal.webform.setActive(context); // Update the template select list upon changing a template. Drupal.webform.updateTemplate(context); // Select all link for file extensions. Drupal.webform.selectCheckboxesLink(context); // Enhance the normal tableselect.js file to support indentations. Drupal.webform.tableSelectIndentation(context); } Drupal.webform = Drupal.webform || {}; Drupal.webform.defaultValues = function(context) { var $fields = $('.webform-default-value:not(.error)', context); var $forms = $fields.parents('form:first'); $fields.each(function() { this.defaultValue = $(this).attr('rel'); if (this.value != this.defaultValue) { $(this).removeClass('webform-default-value'); } $(this).focus(function() { if (this.value == this.defaultValue) { this.value = ''; $(this).removeClass('webform-default-value'); } }); $(this).blur(function() { if (this.value == '') { $(this).addClass('webform-default-value'); this.value = this.defaultValue; } }); }); // Clear all the form elements before submission. $forms.submit(function() { $fields.focus(); }); }; Drupal.webform.setActive = function(context) { var setActive = function(e) { $('.form-radio', $(this).parent().parent()).attr('checked', true); e.preventDefault(); }; $('.webform-set-active', context).click(setActive).change(setActive); }; Drupal.webform.updateTemplate = function(context) { var defaultTemplate = $('#edit-templates-default').val(); var $templateSelect = $('#webform-template-fieldset select#edit-template-option', context); var $templateTextarea = $('#webform-template-fieldset textarea:visible', context); var updateTemplateSelect = function() { if ($(this).val() == defaultTemplate) { $templateSelect.val('default'); } else { $templateSelect.val('custom'); } } var updateTemplateText = function() { if ($(this).val() == 'default' && $templateTextarea.val() != defaultTemplate) { if (confirm(Drupal.settings.webform.revertConfirm)) { $templateTextarea.val(defaultTemplate); } else { $(this).val('custom'); } } } $templateTextarea.keyup(updateTemplateSelect); $templateSelect.change(updateTemplateText); } Drupal.webform.selectCheckboxesLink = function(context) { function selectCheckboxes() { var group = this.className.replace(/.*?webform-select-link-([^ ]*).*/, '$1'); var $checkboxes = $('.webform-select-group-' + group + ' input[type=checkbox]'); var reverseCheck = !$checkboxes[0].checked; $checkboxes.each(function() { this.checked = reverseCheck; }); $checkboxes.trigger('change'); return false; } $('a.webform-select-link', context).click(selectCheckboxes); } Drupal.webform.tableSelectIndentation = function(context) { var $tables = $('th.select-all', context).parents('table'); $tables.find('input.form-checkbox').change(function() { var $rows = $(this).parents('table:first').find('tr'); var row = $(this).parents('tr:first').get(0); var rowNumber = $rows.index(row); var rowTotal = $rows.size(); var indentLevel = $(row).find('div.indentation').size(); for (var n = rowNumber + 1; n < rowTotal; n++) { if ($rows.eq(n).find('div.indentation').size() <= indentLevel) { break; } $rows.eq(n).find('input.form-checkbox').attr('checked', this.checked); } }); } })(jQuery);
JavaScript
/** * JavaScript behaviors for the front-end display of webforms. */ (function ($) { Drupal.behaviors.webform = Drupal.behaviors.webform || {}; Drupal.behaviors.webform.attach = function(context) { // Calendar datepicker behavior. Drupal.webform.datepicker(context); }; Drupal.webform = Drupal.webform || {}; Drupal.webform.datepicker = function(context) { $('div.webform-datepicker').each(function() { var $webformDatepicker = $(this); var $calendar = $webformDatepicker.find('input.webform-calendar'); var startDate = $calendar[0].className.replace(/.*webform-calendar-start-(\d{4}-\d{2}-\d{2}).*/, '$1').split('-'); var endDate = $calendar[0].className.replace(/.*webform-calendar-end-(\d{4}-\d{2}-\d{2}).*/, '$1').split('-'); var firstDay = $calendar[0].className.replace(/.*webform-calendar-day-(\d).*/, '$1'); // Convert date strings into actual Date objects. startDate = new Date(startDate[0], startDate[1] - 1, startDate[2]); endDate = new Date(endDate[0], endDate[1] - 1, endDate[2]); // Ensure that start comes before end for datepicker. if (startDate > endDate) { var laterDate = startDate; startDate = endDate; endDate = laterDate; } var startYear = startDate.getFullYear(); var endYear = endDate.getFullYear(); // Set up the jQuery datepicker element. $calendar.datepicker({ dateFormat: 'yy-mm-dd', yearRange: startYear + ':' + endYear, firstDay: parseInt(firstDay), minDate: startDate, maxDate: endDate, onSelect: function(dateText, inst) { var date = dateText.split('-'); $webformDatepicker.find('select.year, input.year').val(+date[0]); $webformDatepicker.find('select.month').val(+date[1]); $webformDatepicker.find('select.day').val(+date[2]); }, beforeShow: function(input, inst) { // Get the select list values. var year = $webformDatepicker.find('select.year, input.year').val(); var month = $webformDatepicker.find('select.month').val(); var day = $webformDatepicker.find('select.day').val(); // If empty, default to the current year/month/day in the popup. var today = new Date(); year = year ? year : today.getFullYear(); month = month ? month : today.getMonth() + 1; day = day ? day : today.getDate(); // Make sure that the default year fits in the available options. year = (year < startYear || year > endYear) ? startYear : year; // jQuery UI Datepicker will read the input field and base its date off // of that, even though in our case the input field is a button. $(input).val(year + '-' + month + '-' + day); } }); // Prevent the calendar button from submitting the form. $calendar.click(function(event) { $(this).focus(); event.preventDefault(); }); }); } })(jQuery);
JavaScript
/** * @file * Enhancements for select list configuration options. */ (function ($) { Drupal.behaviors.webformSelectLoadOptions = {}; Drupal.behaviors.webformSelectLoadOptions.attach = function(context) { settings = Drupal.settings; $('#edit-extra-options-source', context).change(function() { var url = settings.webform.selectOptionsUrl + '/' + this.value; $.ajax({ url: url, success: Drupal.webform.selectOptionsLoad, dataType: 'json' }); }); } Drupal.webform = Drupal.webform || {}; Drupal.webform.selectOptionsOriginal = false; Drupal.webform.selectOptionsLoad = function(result) { if (Drupal.optionsElement) { if (result.options) { // Save the current select options the first time a new list is chosen. if (Drupal.webform.selectOptionsOriginal === false) { Drupal.webform.selectOptionsOriginal = $(Drupal.optionElements[result.elementId].manualOptionsElement).val(); } $(Drupal.optionElements[result.elementId].manualOptionsElement).val(result.options); Drupal.optionElements[result.elementId].disable(); Drupal.optionElements[result.elementId].updateWidgetElements(); } else { Drupal.optionElements[result.elementId].enable(); if (Drupal.webform.selectOptionsOriginal) { $(Drupal.optionElements[result.elementId].manualOptionsElement).val(Drupal.webform.selectOptionsOriginal); Drupal.optionElements[result.elementId].updateWidgetElements(); Drupal.webform.selectOptionsOriginal = false; } } } else { if (result.options) { $('#' + result.elementId).val(result.options).attr('readonly', 'readonly'); } else { $('#' + result.elementId).attr('readonly', ''); } } } })(jQuery);
JavaScript