2 function decoGreyboxLinks() {
3 var as = AJS.$bytc('a');
4 AJS.map(as, function(a) {
5 if(a.getAttribute('href') && a.getAttribute('rel')) {
6 var rel = a.getAttribute('rel');
7 if(rel.indexOf('gb_') == 0) {
8 var name = rel.match(/\w+/)[0];
9 var attrs = rel.match(/\[(.*)\]/)[1];
13 'caption': a.title || '',
18 if(name == 'gb_pageset' || name == 'gb_imageset') {
19 if(!GB_SETS[attrs]) { GB_SETS[attrs] = []; }
20 GB_SETS[attrs].push(item);
21 index = GB_SETS[attrs].length;
25 if(name == 'gb_pageset') {
26 a.onclick = function() {
27 GB_showFullScreenSet(GB_SETS[attrs], index);
31 if(name == 'gb_imageset') {
32 a.onclick = function() {
33 GB_showImageSet(GB_SETS[attrs], index);
37 if(name == 'gb_image') {
38 a.onclick = function() {
39 GB_showImage(item.caption, item.url);
43 if(name == 'gb_page') {
44 a.onclick = function() {
45 var sp = attrs.split(/, ?/);
46 GB_show(item.caption, item.url, parseInt(sp[1]), parseInt(sp[0]));
50 if(name == 'gb_page_fs') {
51 a.onclick = function() {
52 GB_showFullScreen(item.caption, item.url);
56 if(name == 'gb_page_center') {
57 a.onclick = function() {
58 var sp = attrs.split(/, ?/);
59 GB_showCenter(item.caption, item.url, parseInt(sp[1]), parseInt(sp[0]));
67 AJS.AEV(window, 'load', decoGreyboxLinks);