1 |
85ad3d82
|
Assos Assos
|
|
2 |
|
|
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
(function ($) {
|
6 |
|
|
|
7 |
|
|
function parse_url(url, param) {
|
8 |
|
|
param = param.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
|
9 |
|
|
url = url.replace(/&/, "&");
|
10 |
|
|
var regexS = "[\\?&]"+param+"=([^&#]*)";
|
11 |
|
|
var regex = new RegExp(regexS);
|
12 |
|
|
var results = regex.exec(url);
|
13 |
|
|
if (results === null) {
|
14 |
|
|
return "";
|
15 |
|
|
}
|
16 |
|
|
else {
|
17 |
|
|
return results[1];
|
18 |
|
|
}
|
19 |
|
|
}
|
20 |
|
|
|
21 |
|
|
|
22 |
|
|
function lightbox2_init_triggers(classes, rel_type, custom_class) {
|
23 |
|
|
if (classes == '' || rel_type == 0) {
|
24 |
|
|
return;
|
25 |
|
|
}
|
26 |
|
|
var settings = Drupal.settings.lightbox2;
|
27 |
|
|
|
28 |
|
|
var link_target = "";
|
29 |
|
|
if (settings.node_link_target !== 0) {
|
30 |
|
|
link_target = 'target="'+ settings.node_link_target +'"';
|
31 |
|
|
}
|
32 |
|
|
|
33 |
|
|
$("a:has("+classes+")").each(function(i) {
|
34 |
|
|
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)) {
|
35 |
|
|
var child = $(this).find(classes);
|
36 |
|
|
|
37 |
|
|
if ($(child).attr("class")) {
|
38 |
|
|
|
39 |
|
|
var alt = $(child).attr("alt");
|
40 |
|
|
if (!alt) {
|
41 |
|
|
alt = "";
|
42 |
|
|
}
|
43 |
|
|
|
44 |
|
|
|
45 |
|
|
var link_text = settings.node_link_text;
|
46 |
|
|
var download_link_text = settings.download_link_text;
|
47 |
|
|
var rewrite = 1;
|
48 |
|
|
|
49 |
|
|
|
50 |
|
|
var rel = "lightbox";
|
51 |
|
|
var lightframe = false;
|
52 |
|
|
if (rel_type == "lightframe_ungrouped") {
|
53 |
|
|
rel = "lightframe[]";
|
54 |
|
|
lightframe = true;
|
55 |
|
|
}
|
56 |
|
|
else if (rel_type == "lightframe") {
|
57 |
|
|
lightframe = true;
|
58 |
|
|
}
|
59 |
|
|
else if (rel_type == "lightbox_ungrouped") {
|
60 |
|
|
rel = "lightbox[]";
|
61 |
|
|
}
|
62 |
|
|
if (rel_type != "lightbox_ungrouped" && rel_type != "lightframe_ungrouped") {
|
63 |
|
|
rel = rel_type + "[" + $(child).attr("class") + "]";
|
64 |
|
|
}
|
65 |
|
|
|
66 |
|
|
|
67 |
|
|
|
68 |
|
|
var id = null;
|
69 |
|
|
var href = $(child).attr("src");
|
70 |
|
|
var download = null;
|
71 |
|
|
var orig_href = $(this).attr("href");
|
72 |
|
|
var pattern = new RegExp(settings.file_path);
|
73 |
|
|
if (orig_href.match(pattern)) {
|
74 |
|
|
var lang_pattern = new RegExp(Drupal.settings.basePath + "\\w\\w\\/");
|
75 |
|
|
orig_href = orig_href.replace(lang_pattern, Drupal.settings.basePath);
|
76 |
|
|
}
|
77 |
|
|
var frame_href = orig_href;
|
78 |
|
|
|
79 |
|
|
if ($(child).attr("class").match("flickr-photo-img") ||
|
80 |
|
|
$(child).attr("class").match("flickr-photoset-img")) {
|
81 |
|
|
href = $(child).attr("src").replace("_s.", ".").replace("_t.", ".").replace("_m.", ".").replace("_b.", ".");
|
82 |
|
|
if (rel_type != "lightbox_ungrouped" && rel_type != "lightframe_ungrouped") {
|
83 |
|
|
rel = rel_type + "[flickr]";
|
84 |
|
|
if ($(child).parents("div.block-flickr").attr("class")) {
|
85 |
|
|
id = $(child).parents("div.block-flickr").attr("id");
|
86 |
|
|
rel = rel_type + "["+ id +"]";
|
87 |
|
|
}
|
88 |
|
|
}
|
89 |
|
|
download = href;
|
90 |
|
|
}
|
91 |
|
|
|
92 |
|
|
|
93 |
|
|
else if ($(child).filter("img[class*=img_assist_custom]").size()) {
|
94 |
|
|
|
95 |
|
|
|
96 |
|
|
if (settings.display_image_size != "original") {
|
97 |
|
|
orig_href = orig_href.replace(/\+/, " ");
|
98 |
|
|
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));
|
99 |
|
|
if (rel_type != "lightbox_ungrouped" && rel_type != "lightframe_ungrouped") {
|
100 |
|
|
rel = rel_type + "[node_images]";
|
101 |
|
|
}
|
102 |
|
|
if (lightframe) {
|
103 |
|
|
frame_href = orig_href + "/lightbox2";
|
104 |
|
|
}
|
105 |
|
|
}
|
106 |
|
|
else {
|
107 |
|
|
rewrite = 0;
|
108 |
|
|
}
|
109 |
|
|
}
|
110 |
|
|
|
111 |
|
|
|
112 |
|
|
else if ($(child).attr("class").match("inline")) {
|
113 |
|
|
href = orig_href;
|
114 |
|
|
}
|
115 |
|
|
|
116 |
|
|
|
117 |
|
|
else if ($(child).attr("class").match("ImageFrame_image") || $(child).attr("class").match("ImageFrame_none")) {
|
118 |
|
|
var thumb_id = parse_url(href, "g2_itemId");
|
119 |
|
|
var new_id = parse_url(orig_href, "g2_itemId");
|
120 |
|
|
if (new_id && thumb_id) {
|
121 |
|
|
var g2pattern = new RegExp("g2_itemId="+thumb_id);
|
122 |
|
|
var replacement = "g2_itemId="+ new_id;
|
123 |
|
|
href = href.replace(g2pattern, replacement);
|
124 |
|
|
}
|
125 |
|
|
rel = rel_type + "[gallery2]";
|
126 |
|
|
if ($(child).parents("div.block-gallery").attr("class")) {
|
127 |
|
|
id = $(child).parents("div.block-gallery").attr("id");
|
128 |
|
|
rel = rel_type + "["+ id +"]";
|
129 |
|
|
}
|
130 |
|
|
download = href;
|
131 |
|
|
}
|
132 |
|
|
|
133 |
|
|
|
134 |
|
|
|
135 |
|
|
else if (settings.image_node_sizes != '()' && !custom_class) {
|
136 |
|
|
if (settings.display_image_size != "original") {
|
137 |
|
|
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));
|
138 |
|
|
if (rel_type != "lightbox_ungrouped" && rel_type != "lightframe_ungrouped") {
|
139 |
|
|
rel = rel_type + "[node_images]";
|
140 |
|
|
if ($(child).parents("div.block-multiblock,div.block-image").attr("class")) {
|
141 |
|
|
id = $(child).parents("div.block-multiblock,div.block-image").attr("id");
|
142 |
|
|
rel = rel_type + "["+ id +"]";
|
143 |
|
|
}
|
144 |
|
|
}
|
145 |
|
|
download = $(child).attr("src").replace(new RegExp(settings.image_node_sizes), "").replace(/(image\/view\/\d+)(\/[\w\-]*)/, "$1/_original");
|
146 |
|
|
if (lightframe) {
|
147 |
|
|
frame_href = orig_href + "/lightbox2";
|
148 |
|
|
}
|
149 |
|
|
}
|
150 |
|
|
else {
|
151 |
|
|
rewrite = 0;
|
152 |
|
|
}
|
153 |
|
|
}
|
154 |
|
|
|
155 |
|
|
var img_title = $(child).attr("title");
|
156 |
|
|
if (!img_title) {
|
157 |
|
|
img_title = $(this).attr("title");
|
158 |
|
|
if (!img_title) {
|
159 |
|
|
img_title = $(child).attr("alt");
|
160 |
|
|
}
|
161 |
|
|
$(child).attr({title: img_title});
|
162 |
|
|
}
|
163 |
|
|
if (lightframe) {
|
164 |
|
|
href = frame_href;
|
165 |
|
|
}
|
166 |
|
|
if (rewrite) {
|
167 |
|
|
if (!custom_class) {
|
168 |
|
|
var title_link = "";
|
169 |
|
|
if (link_text.length) {
|
170 |
|
|
title_link = "<br /><br /><a href=\"" + orig_href + "\" id=\"lightbox2-node-link-text\" "+ link_target +" >"+ link_text + "</a>";
|
171 |
|
|
}
|
172 |
|
|
if (download_link_text.length && download) {
|
173 |
|
|
title_link = title_link + " - <a href=\"" + download + "\" id=\"lightbox2-download-link-text\" target=\"_blank\">" + download_link_text + "</a>";
|
174 |
|
|
}
|
175 |
|
|
rel = rel + "[" + img_title + title_link + "]";
|
176 |
|
|
$(this).attr({
|
177 |
|
|
rel: rel,
|
178 |
|
|
href: href
|
179 |
|
|
});
|
180 |
|
|
}
|
181 |
|
|
else {
|
182 |
|
|
if (rel_type != "lightbox_ungrouped" && rel_type != "lightframe_ungrouped") {
|
183 |
|
|
rel = rel_type + "[" + $(child).attr("class") + "]";
|
184 |
|
|
if ($(child).parents("div.block-image").attr("class")) {
|
185 |
|
|
id = $(child).parents("div.block-image").attr("id");
|
186 |
|
|
rel = rel_type + "["+ id +"]";
|
187 |
|
|
}
|
188 |
|
|
}
|
189 |
|
|
rel = rel + "[" + img_title + "]";
|
190 |
|
|
$(this).attr({
|
191 |
|
|
rel: rel,
|
192 |
|
|
href: orig_href
|
193 |
|
|
});
|
194 |
|
|
}
|
195 |
|
|
}
|
196 |
|
|
}
|
197 |
|
|
}
|
198 |
|
|
|
199 |
|
|
});
|
200 |
|
|
}
|
201 |
|
|
|
202 |
|
|
function lightbox2_image_nodes() {
|
203 |
|
|
var settings = Drupal.settings.lightbox2;
|
204 |
|
|
|
205 |
|
|
|
206 |
|
|
var img_assist = document.getElementById("img_assist_thumbs");
|
207 |
|
|
if (!img_assist) {
|
208 |
|
|
|
209 |
|
|
|
210 |
|
|
lightbox2_init_triggers(settings.trigger_lightbox_classes, "lightbox_ungrouped");
|
211 |
|
|
lightbox2_init_triggers(settings.custom_trigger_classes, settings.custom_class_handler, true);
|
212 |
|
|
lightbox2_init_triggers(settings.trigger_lightbox_group_classes, "lightbox");
|
213 |
|
|
lightbox2_init_triggers(settings.trigger_slideshow_classes, "lightshow");
|
214 |
|
|
lightbox2_init_triggers(settings.trigger_lightframe_classes, "lightframe_ungrouped");
|
215 |
|
|
lightbox2_init_triggers(settings.trigger_lightframe_group_classes, "lightframe");
|
216 |
|
|
}
|
217 |
|
|
}
|
218 |
|
|
|
219 |
|
|
Drupal.behaviors.initAutoLightbox = {
|
220 |
|
|
attach: function(context, settings) {
|
221 |
|
|
lightbox2_image_nodes();
|
222 |
|
|
}
|
223 |
|
|
};
|
224 |
|
|
|
225 |
|
|
|
226 |
|
|
}(jQuery)); |