source: main/trunk/greenstone3/web/interfaces/default/js/document_scripts.js@ 28279

Last change on this file since 28279 was 28279, checked in by sjm84, 11 years ago

Added some status information when extracting a document

  • Property svn:executable set to *
File size: 36.3 KB
RevLine 
[25283]1var _imageZoomEnabled = false;
2var _linkCellMap = new Array();
3var _onCells = new Array();
4
[24467]5/********************
6* EXPANSION SCRIPTS *
7********************/
8
[25366]9function getTextForSection(sectionID, callback)
[24467]10{
[25366]11 if(!callback)
12 {
13 console.log("Cannot get text as the callback function is not defined");
14 }
15
16 var template = "";
17 template += '<xsl:template match="/">';
18 template += '<text>';
[25441]19 template += '<xsl:for-each select="/page/pageResponse/document//documentNode[@nodeID = \'' + sectionID + '\']">';
[26020]20 template += '<xsl:call-template name="sectionContent"/>';
[25441]21 template += '</xsl:for-each>';
[25366]22 template += '</text>';
23 template += '</xsl:template>';
24
[25720]25 var hlCheckBox = document.getElementById("highlightOption");
26
27 var hl = "";
28 if(hlCheckBox)
29 {
30 if(hlCheckBox.checked)
31 {
32 hl = "on";
33 }
34 else
35 {
36 hl = "off";
37 }
38 }
39
[26397]40 var url = gs.xsltParams.library_name + "/collection/" + gs.cgiParams.c + "/document/" + sectionID + "?hl=" + hl + "&p.s=TextQuery&ilt=" + template.replace(" ", "%20");
41
42 $.ajax(url)
43 .success(function(response)
[25366]44 {
[26397]45 if(response)
[25366]46 {
[26397]47 var textStart = response.indexOf(">", response.indexOf(">") + 1) + 1;
48 var textEnd = response.lastIndexOf("<");
[25366]49
[26397]50 if(textStart == 0 || textEnd == -1 || textEnd <= textStart)
[25366]51 {
[26397]52 callback("");
[25366]53 }
[26397]54
55 var text = response.substring(textStart, textEnd);
56 callback(text);
[25366]57 }
[26397]58 else
[25366]59 {
60 callback(null);
61 }
[26397]62 })
63 .error(function()
64 {
65 callback(null);
66 });
[25366]67}
68
69function getSubSectionsForSection(sectionID, callback)
70{
71 if(!callback)
72 {
73 console.log("Cannot get sub sections as the callback function is not defined");
74 }
75
76 var template = "";
77 template += '<xsl:template match="/">';
78 template += '<sections>';
[25441]79 template += '<xsl:for-each select="/page/pageResponse/document//documentNode[@nodeID = \'' + sectionID + '\']/documentNode">';
[25366]80 template += '<xsl:call-template name="wrapDocumentNodes"/>';
81 template += '</xsl:for-each>';
82 template += '</sections>';
83 template += '</xsl:template>';
84
[25936]85 var url = gs.xsltParams.library_name + "/collection/" + gs.cgiParams.c + "/document/" + sectionID + "?ilt=" + template.replace(" ", "%20");
86
87 if(gs.documentMetadata.docType == "paged")
88 {
89 url += "&dt=hierarchy";
90 }
[26397]91
92 $.ajax(url)
93 .success(function(response)
[25366]94 {
[26397]95 if(response)
[25366]96 {
[26397]97 var sectionsStart = response.indexOf(">", response.indexOf(">") + 1) + 1;
98 var sectionsEnd = response.lastIndexOf("<");
[25366]99
[26397]100 if(sectionsStart == 0 || sectionsEnd == -1 || sectionsEnd <= sectionsStart)
[25366]101 {
[26397]102 callback(" ");
103 return;
[25366]104 }
[26397]105
106 var sections = response.substring(sectionsStart, sectionsEnd);
107 callback(sections);
[25366]108 }
[26397]109 else
[25366]110 {
111 callback(null);
112 }
[26397]113 })
114 .error(function()
115 {
116 callback(null);
117 });
[25366]118}
119
[25441]120function toggleSection(sectionID, callback, tocDisabled)
[25366]121{
[26397]122 var docElem = gs.jqGet("doc" + sectionID);
123 var tocElem = gs.jqGet("toc" + sectionID);
[24467]124
[26397]125 var tocToggleElem = gs.jqGet("ttoggle" + sectionID);
126 var docToggleElem = gs.jqGet("dtoggle" + sectionID);
[24467]127
[26397]128 if(docElem.css("display") == "none")
[24467]129 {
[26397]130 if(tocToggleElem.length && !tocDisabled)
[24467]131 {
[26397]132 tocToggleElem.attr("src", gs.imageURLs.collapse);
[24467]133 }
134
[26397]135 if(tocElem.length && !tocDisabled)
[24467]136 {
[26397]137 tocElem.css("display", "block");
[24467]138 }
[25366]139
[26397]140 if(docElem.hasClass("noText"))
[25366]141 {
142 getTextForSection(sectionID, function(text)
143 {
144 if(text)
145 {
[25462]146 var nodeID = sectionID.replace(/\./g, "_");
147 if(text.search("wrap" + nodeID) != -1)
148 {
[26408]149 $("#zoomOptions").css("display", "");
150 $("#pagedImageOptions").css("display", "");
[25462]151 }
[25366]152 getSubSectionsForSection(sectionID, function(sections)
[25462]153 {
[25366]154 if(sections)
155 {
[26397]156 var textElem = gs.jqGet("doc" + sectionID);
157 textElem.html(text + sections);
[25366]158
[26397]159 docElem.removeClass("noText");
160 docElem.css("display", "block");
161 docToggleElem.attr("src", gs.imageURLs.collapse);
[25366]162
163 if(callback)
164 {
165 callback(true);
166 }
[25441]167
[26397]168 if(gs.jqGet("viewSelection").length)
[25441]169 {
170 changeView();
171 }
[25366]172 }
173 else
174 {
[26397]175 docToggleElem.attr("src", gs.imageURLs.expand);
[25366]176 if(callback)
177 {
178 callback(false);
179 }
180 }
181 });
182 }
183 else
184 {
[26397]185 docToggleElem.attr("src", gs.imageURLs.expand);
[25366]186 if(callback)
187 {
188 callback(false);
189 }
190 }
191 });
192
[26397]193 docToggleElem.attr("src", gs.imageURLs.loading);
[25366]194 }
195 else
196 {
[26397]197 docToggleElem.attr("src", gs.imageURLs.collapse);
198 docElem.css("display", "block");
[25366]199
200 if(callback)
201 {
202 callback(true);
203 }
204 }
[24467]205 }
206 else
207 {
[26397]208 docElem.css("display", "none");
[24467]209
210 //Use the page image if this is a leaf node and the chapter image if it not
[26397]211 docToggleElem.attr("src", gs.imageURLs.expand);
[24467]212
[26397]213 if(tocToggleElem.length)
[24467]214 {
[26397]215 tocToggleElem.attr("src", gs.imageURLs.expand);
[24467]216 }
217
[26397]218 if(tocElem.length)
[24467]219 {
[26397]220 tocElem.css("display", "none");
[24467]221 }
[25366]222
223 if(callback)
224 {
225 callback(true);
226 }
[24467]227 }
228}
229
[25366]230function scrollToTop()
231{
232 $('html, body').stop().animate({scrollTop: 0}, 1000);
233}
234
[25441]235function focusSection(sectionID, level, tocDisabled)
[25366]236{
237 if(!level)
238 {
239 level = 0;
240 }
241
242 var parts = sectionID.split(".");
243 if(level >= parts.length)
244 {
245 var topVal = $(document.getElementById("doc" + sectionID)).offset().top - 50;
246 $('html, body').stop().animate({scrollTop: topVal}, 1000);
247 return;
248 }
249
250 var idToExpand = "";
251 for(var i = 0; i < level + 1; i++)
252 {
253 if(i > 0)
254 {
255 idToExpand += ".";
256 }
257
258 idToExpand += parts[i];
259 }
260
261 if(!isExpanded(idToExpand))
262 {
263 toggleSection(idToExpand, function(success)
264 {
265 if(success)
266 {
[25441]267 focusSection(sectionID, level + 1, tocDisabled);
[25366]268 }
[25441]269 }, tocDisabled);
[25366]270 }
271 else
272 {
[25441]273 focusSection(sectionID, level + 1, tocDisabled);
[25366]274 }
275}
276
277function expandOrCollapseAll(expand)
278{
[26397]279 var divs = $("div");
[25366]280 var startCounter = 0;
281 var endCounter = 0;
282
283 for(var i = 0; i < divs.length; i++)
284 {
[26397]285 if($(divs[i]).attr("id") && $(divs[i]).attr("id").search(/^doc/) != -1)
[25366]286 {
[26397]287 var id = $(divs[i]).attr("id").replace(/^doc(.*)/, "$1");
[25366]288 if(isExpanded(id) != expand)
289 {
290 //Don't collapse the top level
291 if(!expand && id.indexOf(".") == -1)
292 {
293 continue;
294 }
295 startCounter++;
[25462]296
[25366]297 var toggleFunction = function(tid)
298 {
299 toggleSection(tid, function(success)
300 {
301 if(success)
302 {
303 endCounter++;
304 }
305 else
306 {
307 setTimeout(function(){toggleFunction(tid)}, 500);
308 }
309 });
310 }
311 toggleFunction(id);
312 }
313 }
314 }
315
316 if(startCounter != 0)
317 {
318 var checkFunction = function()
319 {
320 if(startCounter == endCounter)
321 {
322 expandOrCollapseAll(expand);
323 }
324 else
325 {
326 setTimeout(checkFunction, 500);
327 }
328 }
[25441]329 checkFunction();
[25366]330 }
331}
332
[25936]333function loadTopLevelPage(callbackFunction, customURL)
[25366]334{
[26397]335 var url;
336 if(customURL)
[25641]337 {
[26397]338 url = customURL;
[25641]339 }
[25936]340 else
341 {
[26397]342 url = gs.xsltParams.library_name + "?a=d&c=" + gs.cgiParams.c + "&excerptid=gs-document";
343 if(gs.cgiParams.d && gs.cgiParams.d.length > 0)
344 {
345 url += "&d=" + gs.cgiParams.d.replace(/([^.]*)\..*/, "$1");
346 }
347 else if(gs.cgiParams.href && gs.cgiParams.href.length > 0)
348 {
349 url += "&d=&alb=1&rl=1&href=" + gs.cgiParams.href;
350 }
[25936]351 }
[26205]352
[26397]353 $.ajax(url)
354 .success(function(response)
[25366]355 {
[26397]356 if(response)
[25366]357 {
[26401]358 var targetElem = $("#gs-document");
[26397]359 var docStart = response.indexOf(">") + 1;
360 var docEnd = response.lastIndexOf("<");
361 var doc = response.substring(docStart, docEnd);
362
363 targetElem.html(doc);
[25366]364
[26397]365 if(callbackFunction)
[25366]366 {
[26397]367 callbackFunction();
[25366]368 }
369 }
[26397]370 })
371 .error(function()
372 {
373 setTimeout(function(){loadTopLevelPage(callbackFunction, customURL);}, 1000);
374 });
[25366]375}
376
377function retrieveFullTableOfContents()
378{
[25641]379 var url = gs.xsltParams.library_name + "/collection/" + gs.cgiParams.c + "?excerptid=tableOfContents&ed=1";
380 if(gs.cgiParams.d && gs.cgiParams.d.length > 0)
381 {
382 url += "&a=d&d=" + gs.cgiParams.d;
383 }
384 else if(gs.cgiParams.href && gs.cgiParams.href.length > 0)
385 {
[25660]386 url += "&a=d&d=&alb=1&rl=1&href=" + gs.cgiParams.href;
[25641]387 }
[26397]388
389 $.ajax(url)
390 .success(function(newTOCElem)
[25366]391 {
[26397]392 var tocStart = newTOCElem.indexOf(">") + 1;
393 var tocEnd = newTOCElem.lastIndexOf("<");
394
395 var newTOC = newTOCElem.substring(tocStart, tocEnd);
396
397 //Add the "Expand document"/"Collapse document" links
398 newTOC = "<table style=\"width:100%; text-align:center;\"><tr><td><a href=\"javascript:expandOrCollapseAll(true);\">Expand document</a></td><td><a href=\"javascript:expandOrCollapseAll(false);\">Collapse document</a></td></tr></table>" + newTOC;
399
400 //Collapse the TOC
401 newTOC = newTOC.replace(/display:block/g, "display:none");
402 newTOC = newTOC.replace(/display:none/, "display:block");
403 newTOC = newTOC.replace(/images\/collapse/g, "images/expand");
404
[26401]405 var tocElem = $("#tableOfContents");
[26397]406 tocElem.html(newTOC);
407
408 gs.variables.tocLoaded = true;
409 })
410 .error(function()
411 {
412 setTimeout(retrieveFullTableOfContents, 1000);
413 });
[25366]414}
415
[24467]416function isExpanded(sectionID)
417{
[26397]418 var docElem = gs.jqGet("doc" + sectionID);
419 if(docElem.css("display") == "block")
[24467]420 {
421 return true;
422 }
423 return false;
424}
425
[24655]426function minimizeSidebar()
427{
[26401]428 var toc = $("#contentsArea");
429 var maxLink = $("#sidebarMaximizeButton");
430 var minLink = $("#sidebarMinimizeButton");
[24655]431
[26397]432 if(toc.length)
[24655]433 {
[26397]434 toc.css("display", "none");
[24655]435 }
436
[26397]437 maxLink.css("display", "block");
438 minLink.css("display", "none");
[24655]439}
440
441function maximizeSidebar()
442{
[26401]443 var coverImage = $("#coverImage");
444 var toc = $("#contentsArea");
445 var maxLink = $("#sidebarMaximizeButton");
446 var minLink = $("#sidebarMinimizeButton");
[24655]447
[26397]448 if(coverImage.length)
[24655]449 {
[26397]450 coverImage.css("display", "block");
[24655]451 }
452
[26397]453 if(toc.length)
[24655]454 {
[26397]455 toc.css("display", "block");
[24655]456 }
457
[26397]458 maxLink.css("display", "none");
459 minLink.css("display", "block");
[24655]460}
461
[28253]462function extractFilteredPagesToOwnDocument()
463{
464 var oids = new Array();
465 var filtered = $(".pageSliderCol:visible a").each(function()
466 {
467 var hrefString = $(this).attr("href");
468 var oidStart = hrefString.indexOf(".") + 1;
469 var oidFinish = hrefString.indexOf("'", oidStart + 1);
470
471 oids.push(hrefString.substring(oidStart, oidFinish));
472 });
473
474 var sectionString = "[";
475 for(var i = 0; i < oids.length; i++)
476 {
477 sectionString += "\"" + oids[i] + "\"";
478 if(i < oids.length - 1)
479 {
480 sectionString += ",";
481 }
482 }
483 sectionString += "]";
484
[28279]485 var url = "cgi-bin/document-extract.pl?a=extract-archives-doc&c=" + gs.cgiParams.c + "&d=" + gs.cgiParams.d + "&json-sections=" + sectionString + "&site=" + gs.xsltParams.site_name;// + "&json-metadata=[{"metaname":"dc.Title","metavalue":"All Black Rugy Success","metamode":"accumulate"]"
486 $("#extractDocButton").attr("disabled", "disabled").html("Exracting document...");
[28253]487 $.ajax(url)
488 .success(function(response)
489 {
[28279]490 $("#extractDocButton").html("Building collection...");
[28255]491 gs.functions.buildCollections([gs.cgiParams.c], function()
492 {
[28279]493 $("#extractDocButton").removeAttr("disabled").html("Extract these pages to document");
[28255]494 });
[28279]495 })
496 .error(function()
497 {
498 $("#extractDocButton").removeAttr("disabled").html("Extract these pages to document");
[28253]499 });
500}
501
[25009]502/**********************
503* PAGED-IMAGE SCRIPTS *
504**********************/
505
506function changeView()
507{
[26401]508 var viewList = $("#viewSelection");
[26397]509 var currentVal = viewList.val();
[25009]510
511 var view;
512 if(currentVal == "Image view")
513 {
514 setImageVisible(true);
515 setTextVisible(false);
516 view = "image";
517 }
518 else if(currentVal == "Text view")
519 {
520 setImageVisible(false);
521 setTextVisible(true);
522 view = "text";
523 }
524 else
525 {
526 setImageVisible(true);
527 setTextVisible(true);
528 view = "";
529 }
530
[26397]531 var url = gs.xsltParams.library_name + "?a=d&view=" + view + "&c=" + gs.cgiParams.c;
532 $.ajax(url);
[25009]533}
534
535function setImageVisible(visible)
536{
[26401]537 $("div").each(function()
[25009]538 {
[26401]539 if($(this).attr("id") && $(this).attr("id").search(/^image/) != -1)
[25177]540 {
[26401]541 $(this).css("display", (visible ? "block" : "none"));
[25177]542 }
[26401]543 });
[25009]544}
545
546function setTextVisible(visible)
547{
[26401]548 $("div").each(function()
[25009]549 {
[26401]550 if($(this).attr("id") && $(this).attr("id").search(/^text/) != -1)
[25177]551 {
[26401]552 $(this).css("display", (visible ? "block" : "none"));
[25177]553 }
[26401]554 });
[25009]555}
556
[25283]557function retrieveTableOfContentsAndTitles()
[25009]558{
[25441]559 var ilt = "";
560 ilt += '<xsl:template match="/">';
[25660]561 ilt += '<xsl:for-each select="/page/pageResponse/document/documentNode">';
562 ilt += '<xsl:call-template name="documentNodeTOC"/>';
563 ilt += '</xsl:for-each>';
[25441]564 ilt += '</xsl:template>';
[26397]565
566 var url = gs.xsltParams.library_name + "?a=d&ed=1&c=" + gs.cgiParams.c + "&d=" + gs.cgiParams.d + "&ilt=" + ilt.replace(/ /g, "%20");
[25441]567
[26397]568 $.ajax(url)
569 .success(function(response)
[25009]570 {
[26401]571 $("#tableOfContents").html(response);
[26397]572 replaceLinksWithSlider();
[26401]573 var loading = $("#tocLoadingImage");
[26397]574 loading.remove();
575 })
576 .error(function()
577 {
578 setTimeout(function(){retrieveTableOfContentsAndTitles();}, 1000);
579 });
[25009]580}
581
582function replaceLinksWithSlider()
583{
[26401]584 var tableOfContents = $("#tableOfContents");
585
[25009]586 var leafSections = new Array();
[26401]587 var liElems = tableOfContents.find("li").each(function()
[25009]588 {
[26401]589 var section = $(this);
[25009]590 var add = true;
591 for(var j = 0; j < leafSections.length; j++)
592 {
593 if(leafSections[j] == undefined){continue;}
594
[26397]595 var leaf = $(leafSections[j]);
596 if(leaf.attr("id").search(section.attr("id")) != -1)
[25009]597 {
598 add = false;
599 }
600
[26397]601 if(section.attr("id").search(leaf.attr("id")) != -1)
[25009]602 {
603 delete leafSections[j];
604 }
605 }
[26397]606
[25009]607 if(add)
608 {
609 leafSections.push(section);
610 }
[26401]611 });
[25009]612
613 for(var i = 0 ; i < leafSections.length; i++)
614 {
615 if(leafSections[i] == undefined){continue;}
[26397]616
617 leafSections[i].css("display", "none");
618 var links = leafSections[i].find("a");
619
[25009]620 var widget = new SliderWidget(links);
[26397]621 leafSections[i].before(widget.getElem());
[25009]622 }
[26397]623
[25441]624 //Disable all TOC toggles
[26401]625 var imgs = $("img").each(function()
[25283]626 {
[26401]627 var currentImage = $(this);
[26397]628 if(currentImage.attr("id") && currentImage.attr("id").search(/^ttoggle/) != -1)
[25283]629 {
[26397]630 currentImage.attr("onclick", "");
[28253]631 currentImage.click(function()
632 {
633 var sliderDiv = currentImage.parents("table").first().next();
634 if(sliderDiv.is(":visible"))
635 {
636 sliderDiv.hide();
637 }
638 else
639 {
640 sliderDiv.show();
641 }
642 });
[25283]643 }
[26397]644 else if(currentImage.attr("id") && currentImage.attr("id").search(/^dtoggle/) != -1)
[25441]645 {
[26397]646 currentImage.attr("onclick", currentImage.attr("onclick").replace(/\)/, ", null, true)"));
[25441]647 }
[26401]648 });
[25283]649}
650
[25009]651function SliderWidget(_links)
652{
653 //****************
654 //MEMBER VARIABLES
655 //****************
656
657 //The container for the widget
[26397]658 var _mainDiv = $("<div>");
659 _mainDiv.attr("class", "ui-widget-content pageSlider");
[25009]660
661 //The table of images
[26397]662 var _linkTable = $("<table>");
663 _mainDiv.append(_linkTable);
[25009]664
665 //The image row of the table
[26397]666 var _linkRow = $("<tr>");
667 _linkTable.append(_linkRow);
[25009]668
[25283]669 //The list of titles we can search through
670 var _titles = new Array();
[26397]671
672 //Keep track of the slider position
673 var _prevScroll = 0;
[25009]674
675 //****************
676 //PUBLIC FUNCTIONS
677 //****************
678
679 //Function that returns the widget element
680 this.getElem = function()
681 {
682 return _mainDiv;
683 }
684
685 //*****************
686 //PRIVATE FUNCTIONS
687 //*****************
688
[25283]689 var setUpFilterBox = function()
690 {
691 var filter = $("#filterText");
692 filter.keyup(function()
693 {
[28253]694 var fullValue = filter.val();
[28247]695 var values = fullValue.split(",");
[25295]696
[28247]697 var matchingTitles = new Array();
698
699 for (var l = 0; l < values.length; l++)
[25283]700 {
[28253]701 var currentValue = values[l].replace(/^ +/g, "").replace(/ +$/g, "");
[28247]702 var isRange = (currentValue.search(/\d+-\d+/) != -1)
703
704 var found = false;
705 for(var i = 0; i < _titles.length; i++)
[25283]706 {
[28247]707 if(_titles[i][0] == currentValue)
708 {
709 found = true;
710 }
[25283]711 }
[25295]712
[28247]713 if(!found && isRange)
[25283]714 {
[28247]715 var firstNumber = currentValue.replace(/(\d+)-\d+/, "$1");
716 var secondNumber = currentValue.replace(/\d+-(\d+)/, "$1");
717
718 if(firstNumber <= secondNumber)
[25295]719 {
[28247]720 for(var i = firstNumber; i <= secondNumber; i++)
[25295]721 {
[28247]722 var numString = i + "";
723 for(var j = 0; j < _titles.length; j++)
[25295]724 {
[28247]725 var currentTitle = _titles[j];
726 if(currentTitle[0].search(numString) != -1)
727 {
728 matchingTitles.push(currentTitle);
729 }
[25295]730 }
731 }
732 }
[28247]733 }
734 else
735 {
[25295]736 for(var i = 0; i < _titles.length; i++)
737 {
[28247]738 var currentTitle = _titles[i];
739 if(currentTitle[0].search(currentValue.replace(/\./g, "\\.")) != -1)
740 {
741 matchingTitles.push(currentTitle);
742 }
[25295]743 }
[25283]744 }
745 }
[28247]746
747 for(var i = 0; i < _titles.length; i++)
[25295]748 {
[28247]749 $(_titles[i][1].cell).css("display", "none");
[25295]750 }
[28247]751
752 for(var i = 0; i < matchingTitles.length; i++)
753 {
754 $(matchingTitles[i][1].cell).css("display", "table-cell");
755 }
[25283]756 });
757 }
758
[26212]759 var getImage = function(page, attemptNumber)
[25009]760 {
761 var href = page.getAttribute("href");
[25441]762 var startHREF = href.indexOf("'") + 1;
763 var endHREF = href.indexOf("'", startHREF);
764 var nodeID = href.substring(startHREF, endHREF);
765 href = gs.xsltParams.library_name + "/collection/" + gs.cgiParams.c + "/document/" + nodeID;
766
[25177]767 var template = '';
768 template += '<xsl:template match="/">';
[25441]769 template += '<gsf:metadata name=\"Thumb\"/>';
[25177]770 template += '<html>';
771 template += '<img>';
772 template += '<xsl:attribute name="src">';
773 template += "<xsl:value-of disable-output-escaping=\"yes\" select=\"/page/pageResponse/collection/metadataList/metadata[@name = 'httpPath']\"/>";
774 template += '<xsl:text>/index/assoc/</xsl:text>';
775 template += "<xsl:value-of disable-output-escaping=\"yes\" select=\"/page/pageResponse/document/metadataList/metadata[@name = 'assocfilepath']\"/>";
776 template += '<xsl:text>/</xsl:text>';
[25441]777 template += "<xsl:value-of disable-output-escaping=\"yes\" select=\"/page/pageResponse/document//documentNode[@nodeID = '" + nodeID + "']/metadataList/metadata[@name = 'Thumb']\"/>";
[25177]778 template += '</xsl:attribute>';
779 template += '</img>';
[25283]780 template += '<p>';
781 template += "<xsl:value-of disable-output-escaping=\"yes\" select=\"/page/pageResponse/document/documentNode/metadataList/metadata[@name = 'Title']\"/>";
782 template += '</p>';
[25177]783 template += '</html>';
784 template += '</xsl:template>';
[25441]785
[26397]786 var url = href + "?ilt=" + template.replace(" ", "%20");
787 $.ajax(url)
788 .success(function(text)
[25009]789 {
[26397]790 var hrefStart = text.indexOf("src=\"") + 5;
791 if(hrefStart == -1)
[25009]792 {
[26397]793 page.isLoading = false;
794 page.noImage = true;
795 $(page.image).attr("src", gs.imageURLs.blank);
796 return;
797 }
798 var hrefEnd = text.indexOf("\"", hrefStart);
799 var href = text.substring(hrefStart, hrefEnd);
[25283]800
[26397]801 var image = $("<img>");
802 image.load(function()
[25009]803 {
[26397]804 $(page.link).html("");
805 $(page.link).append(image);
806 page.isLoading = false;
807 page.imageLoaded = true;
808 });
809 image.error(function()
810 {
[26212]811 if(!attemptNumber || attemptNumber < 3)
812 {
813 setTimeout(function(){getImage(page, ((!attemptNumber) ? 1 : attemptNumber + 1));}, 500);
814 }
815 else
816 {
817 page.isLoading = false;
818 page.noImage = true;
[26397]819 image.attr("src", gs.imageURLs.blank);
[26212]820 }
[26397]821 });
822 image.attr("src", href);
823
824 var titleStart = text.indexOf("<p>") + 3;
825 var titleEnd = text.indexOf("</p>");
826 var title = text.substring(titleStart, titleEnd);
827 })
828 .error(function()
829 {
830 page.failed = true;
831 if(!attemptNumber || attemptNumber < 3)
832 {
833 setTimeout(function(){getImage(page, ((!attemptNumber) ? 1 : attemptNumber + 1));}, 500);
[25009]834 }
[26397]835 else
836 {
[26401]837 var image = $("<img>", {"src": gs.imageURLs.blank});
838 $(page.link).html("");
839 $(page.link).append(image);
[26397]840 page.isLoading = false;
841 page.noImage = true;
842 }
843 });
[25009]844 }
845
846 var startCheckFunction = function()
847 {
[26397]848 var checkFunction = function(forced)
[25009]849 {
[26397]850 //Don't bother checking if we haven't scrolled very far
851 if(Math.abs(_mainDiv.scrollLeft() - _prevScroll) > 100 || forced)
[25009]852 {
[26397]853 _prevScroll = _mainDiv.scrollLeft();
854 _checking = true;
855 var widgetLeft = _mainDiv.offset().left;
856 var widgetRight = widgetLeft + _mainDiv.width();
857
858 var visiblePages = new Array();
859 for(var i = 0; i < _links.length; i++)
[25009]860 {
[26397]861 var current = _links[i].cell;
862 var currentLeft = current.offset().left;
863 var currentRight = currentLeft + current.width();
864
865 if(currentRight > widgetLeft && currentLeft < widgetRight)
866 {
867 visiblePages.push(_links[i]);
868 }
[25009]869 }
[26397]870
871 for(var i = 0; i < visiblePages.length; i++)
[25009]872 {
[26397]873 var page = visiblePages[i];
874 if(!page || page.imageLoaded || page.noImage || page.isLoading)
875 {
876 continue;
877 }
878
879 page.isLoading = true;
880 getImage(page);
[25009]881 }
[26397]882 _checking = false;
[25009]883 }
884 }
[26397]885
886 setTimeout(checkFunction, 250);
887 setInterval(function(){checkFunction(true)}, 2000);
888 _mainDiv.scroll(checkFunction);
[25009]889 }
890
891 //***********
892 //CONSTRUCTOR
893 //***********
894
895 for(var i = 0; i < _links.length; i++)
896 {
[26397]897 var col = $("<td>");
898 _linkRow.append(col);
899 col.addClass("pageSliderCol");
[25009]900 _links[i].cell = col;
[26401]901
[26397]902 var link = $("<a>");
903 col.append(link);
[25009]904 _links[i].link = link;
[26397]905 var href = $(_links[i]).attr("href");
906 link.attr("href", href.replace(/\)/, ", 0, true)"));
[26401]907
[25283]908 if(!_linkCellMap[href])
909 {
910 _linkCellMap[href] = new Array();
911 }
912 _linkCellMap[href].push(_links[i]);
[26401]913
[26397]914 var loadingText = $("<p>Loading image</p>");
915 link.append(loadingText);
[26401]916
[26397]917 var image = $("<img>");
918 link.append(image);
919 image.attr("src", gs.imageURLs.loading);
[25009]920 _links[i].image = image;
[26401]921
[26397]922 var title = $(_links[i]).html();
[25283]923 if(title.search(/^[^ ]+ [^ ]+$/) != -1)
924 {
925 var section = title.replace(/^([^ ]+) [^ ]+$/, "$1");
926 var page = title.replace(/^[^ ]+ ([^ ]+)$/, "$1");
927 if(page.search(/^[0-9]+$/) != -1)
928 {
929 title = page;
930 }
931 }
932 _titles.push([title, _links[i]]);
[26401]933
[26397]934 col.append($("<br>"));
935 col.append(title);
[25009]936 }
[26401]937
[25283]938 setUpFilterBox();
[25009]939 startCheckFunction();
940}
941
[24467]942/***********************
943* HIGHLIGHTING SCRIPTS *
944***********************/
[26307]945function swapHighlight(imageClicked)
[24467]946{
[26397]947 var hlCheckbox = $("#highlightOption");
[26307]948
949 if(imageClicked)
950 {
951 $(hlCheckbox).attr("checked", !$(hlCheckbox).attr("checked"));
952 }
[25720]953
954 var from;
955 var to;
[26397]956 if(hlCheckbox.attr("checked"))
[24467]957 {
[25720]958 from = "noTermHighlight";
959 to = "termHighlight";
[24467]960 }
[25720]961 else
962 {
963 from = "termHighlight";
964 to = "noTermHighlight";
965 }
[26397]966
967 var spans = $("span").each(function()
[24467]968 {
[26397]969 if($(this).hasClass(from))
[24467]970 {
[26397]971 $(this).removeClass(from);
972 $(this).addClass(to);
[24467]973 }
[26397]974 });
[24467]975}
976
977/**************************
978* REALISTIC BOOKS SCRIPTS *
979**************************/
980
981function bookInit()
982{
983 loadBook();
984 hideText();
985 showBook();
986 swapLinkJavascript(false);
987}
988
989function hideText()
990{
[26397]991 $("#gs-document-text").css("visibility", "hidden");
[24467]992}
993
994function showText()
995{
[26397]996 $("#gs-document-text").css("visibility", "visible");
[24467]997}
998
999function hideBook()
1000{
[26397]1001 $("#bookDiv, #bookObject, #bookEmbed").css({"visibility": "hidden", "height": "0px"});
[24467]1002}
1003
1004function showBook()
1005{
[26397]1006 $("#bookDiv, #bookObject, #bookEmbed").css({"visibility": "visible", "height": "600px"});
[24467]1007}
1008
1009function swapLinkJavascript(rbOn)
1010{
[26397]1011 var option = $("#rbOption");
1012 var optionImage = $("#rbOptionImage");
[26307]1013
[24467]1014 if(rbOn)
1015 {
[26397]1016 option.attr("onclick", "hideText(); showBook(); swapLinkJavascript(false);");
1017 optionImage.attr("onclick", "hideText(); showBook(); swapLinkJavascript(false);");
[26307]1018 $(option).attr("checked", false);
[24467]1019 }
1020 else
1021 {
[26397]1022 option.attr("onclick", "hideBook(); showText(); swapLinkJavascript(true);");
1023 optionImage.attr("onclick", "hideBook(); showText(); swapLinkJavascript(true);");
[26307]1024 $(option).attr("checked", true);
[24467]1025 }
1026}
1027
1028function loadBook()
1029{
1030 var doc_url = document.URL;
1031 doc_url = doc_url.replace(/(&|\?)book=[a-z]+/gi,'');
1032 doc_url += '&book=flashxml';
1033
1034 var img_cover = gs.collectionMetadata.httpPath + '/index/assoc/' + gs.documentMetadata.assocfilepath + '/cover.jpg';
1035
1036 var flash_plug_html = ""
1037 flash_plug_html += '<OBJECT align="middle" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" \n';
1038 flash_plug_html += ' height="600px" id="bookObject" swLiveConnect="true" \n';
1039 flash_plug_html += ' codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" \n';
1040 flash_plug_html += ' width="70%">\n';
1041 flash_plug_html += ' <PARAM name="allowScriptAccess" value="always" />\n';
1042 flash_plug_html += ' <PARAM name="movie" value="Book.swf';
1043 flash_plug_html += '?src_image=' + escape(img_cover);
[25142]1044 flash_plug_html += '&doc_url=' + escape(doc_url);
[24467]1045 flash_plug_html += '" />\n';
1046 flash_plug_html += ' <PARAM name="quality" value="high" />\n';
1047 flash_plug_html += ' <PARAM name="bgcolor" value="#FFFFFF" />\n';
1048 flash_plug_html += ' <EMBED align="middle" \n';
1049 flash_plug_html += ' allowScriptAccess="always" swLiveConnect="true" \n';
1050 flash_plug_html += ' bgcolor="#FFFFFF" height="600px" name="Book" \n';
1051 flash_plug_html += ' pluginspage="http://www.macromedia.com/go/getflashplayer" \n';
1052 flash_plug_html += ' quality="high" id="bookEmbed"\n';
1053 flash_plug_html += ' src="Book.swf';
1054 flash_plug_html += '?src_image=' + escape(img_cover);
1055 flash_plug_html += '&doc_url=' + escape(doc_url);
1056 flash_plug_html += '"\n';
1057 flash_plug_html += ' type="application/x-shockwave-flash" width="70%" />\n';
1058 flash_plug_html += '</OBJECT>\n';
[26397]1059 $("#bookdiv").html(flash_plug_html);
[25142]1060}
1061
[26397]1062/************************
1063* METADATA EDIT SCRIPTS *
1064************************/
1065
[25143]1066function addEditMetadataLink(cell)
1067{
[26397]1068 cell = $(cell);
1069 var id = cell.attr("id").substring(6);
1070 var metaTable = gs.jqGet("meta" + id);
[25143]1071
[26397]1072 var row = cell.parent();
1073 var newCell = $("<td>", {"style": "font-size:0.7em; padding:0px 10px", "class": "editMetadataButton"});
1074 var linkSpan = $("<span>", {"class": "ui-state-default ui-corner-all", "style": "padding: 2px; float:left;"});
[25177]1075
[26397]1076 var linkLabel = $("<span>edit metadata</span>");
1077 var linkIcon = $("<span>", {"class": "ui-icon ui-icon-folder-collapsed"});
1078 newCell.linkIcon = linkIcon;
[25283]1079 newCell.linkLabel = linkLabel;
[25177]1080
[26397]1081 var uList = $("<ul>", {"style": "outline: 0 none; margin:0px; padding:0px;"});
1082 var labelItem = $("<li>", {"style": "float:left; list-style:none outside none;"});
1083 var iconItem = $("<li>", {"style": "float:left; list-style:none outside none;"});
1084
1085 uList.append(iconItem);
1086 uList.append(labelItem);
1087 labelItem.append(linkLabel);
1088 iconItem.append(linkIcon);
[25177]1089
[26397]1090 var newLink = $("<a>", {"href": "javascript:;"});
1091 newLink.click(function()
[25143]1092 {
[26397]1093 if(metaTable.css("display") == "none")
[25143]1094 {
[26397]1095 linkLabel.html("hide metadata");
1096 linkIcon.attr("class", "ui-icon ui-icon-folder-open");
1097 metaTable.css("display", "block");
1098 metaTable.metaNameField.css("display", "inline");
1099 metaTable.addRowButton.css("display", "inline");
[25143]1100 }
1101 else
1102 {
[26397]1103 linkLabel.html("edit metadata");
1104 linkIcon.attr("class", "ui-icon ui-icon-folder-collapsed");
1105 metaTable.css("display", "none");
1106 metaTable.metaNameField.css("display", "none");
1107 metaTable.addRowButton.css("display", "none");
[25143]1108 }
[26397]1109 });
1110
1111 newLink.append(uList);
1112 linkSpan.append(newLink);
1113 newCell.append(linkSpan);
1114 row.append(newCell);
[25143]1115
1116 addFunctionalityToTable(metaTable);
[26397]1117 metaTable.metaNameField.css("display", "none");
1118 metaTable.addRowButton.css("display", "none");
[25143]1119}
1120
[25283]1121function setEditingFeaturesVisible(visible)
1122{
1123 if(visible)
1124 {
[26397]1125 $("#editContentButton").html("Hide editor");
[25283]1126 }
1127 else
1128 {
[26397]1129 $("#editContentButton").html("Edit content");
[25283]1130 }
1131
1132 var visibility = (visible ? "" : "none");
[26397]1133 $("#saveButton, #metadataListLabel, #metadataSetList").css("display", visibility);
[25283]1134
[26397]1135 $(".editMetadataButton").each(function()
[25283]1136 {
[26397]1137 $(this).css("display", visibility);
1138 $(this.linkLabel).html("edit metadata");
1139 $(this.linkIcon).attr("class", "ui-icon ui-icon-folder-collapsed");
1140 });
[25283]1141
[26397]1142 $("table").each(function()
[25283]1143 {
[26397]1144 if($(this).attr("id") && $(this).attr("id").search(/^meta/) != -1)
[25283]1145 {
[26397]1146 $(this).css("display", "none");
1147 $(this.metaNameField).css("display", "none");
1148 $(this.addRowButton).css("display", "none");
[25283]1149 }
[26397]1150 });
[25283]1151}
1152
[25142]1153function readyPageForEditing()
1154{
[26397]1155 if($("#metadataSetList").length)
[25283]1156 {
[26397]1157 var setList = $("#metadataSetList");
1158 if(!setList.css("display") || setList.css("display") == "")
[25283]1159 {
1160 setEditingFeaturesVisible(false);
1161 }
1162 else
1163 {
1164 setEditingFeaturesVisible(true);
1165 }
1166 return;
1167 }
1168
[26397]1169 $("#editContentButton").html("Hide Editor");
[25283]1170
[26397]1171 var textDivs = $(".sectionText").each(function(){de.doc.registerEditSection(this);});
[25142]1172
[26397]1173 var editBar = $("#editBarLeft");
[26704]1174
1175 var saveButton = $("<button>", {"id": "saveButton", "class": "ui-state-default ui-corner-all"});
[26397]1176 saveButton.click(save);
1177 saveButton.html("Save changes");
1178 editBar.append(saveButton);
[25142]1179
[26704]1180
[26397]1181 var visibleMetadataList = $("<select>", {"id": "metadataSetList"});
1182 var allOption = $("<option>All</option>");
1183 visibleMetadataList.append(allOption);
1184
1185 var metadataListLabel = $("<span>", {"id": "metadataListLabel", "style": "margin-left:20px;"});
1186 metadataListLabel.html("Visible metadata: ");
1187 editBar.append(metadataListLabel);
1188 editBar.append(visibleMetadataList);
1189 visibleMetadataList.change(onVisibleMetadataSetChange);
[25143]1190
[26397]1191 var statusBarDiv = $("<div>");
1192 editBar.append(statusBarDiv);
1193 _statusBar = new StatusBar(statusBarDiv[0]);
[25142]1194
[26397]1195 var titleDivs = $(".sectionTitle");
[25143]1196 for(var i = 0; i < titleDivs.length; i++)
1197 {
1198 addEditMetadataLink(titleDivs[i]);
1199 }
1200
[25142]1201 _baseURL = gs.xsltParams.library_name;
[26203]1202}
1203
[26397]1204/***************
1205* MENU SCRIPTS *
1206***************/
1207
[26226]1208function floatMenu(enabled)
1209{
1210 var menu = $(".tableOfContentsContainer");
1211 if(enabled)
1212 {
1213 menu.data("position", menu.css("position"));
1214 menu.data("width", menu.css("width"));
1215 menu.data("right", menu.css("right"));
1216 menu.data("top", menu.css("top"));
1217 menu.data("max-height", menu.css("max-height"));
1218 menu.data("overflow", menu.css("overflow"));
1219 menu.data("z-index", menu.css("z-index"));
1220
1221 menu.css("position", "fixed");
1222 menu.css("width", "300px");
1223 menu.css("right", "0px");
1224 menu.css("top", "100px");
1225 menu.css("max-height", "600px");
1226 menu.css("overflow", "auto");
1227 menu.css("z-index", "200");
1228
1229 $("#unfloatTOCButton").show();
1230 }
1231 else
1232 {
1233 menu.css("position", menu.data("position"));
1234 menu.css("width", menu.data("width"));
1235 menu.css("right", menu.data("right"));
1236 menu.css("top", menu.data("top"));
1237 menu.css("max-height", menu.data("max-height"));
1238 menu.css("overflow", menu.data("overflow"));
1239 menu.css("z-index", menu.data("z-index"));
1240
1241 $("#unfloatTOCButton").hide();
1242 $("#floatTOCToggle").attr("checked", false);
1243 }
[26308]1244
[26397]1245 var url = gs.xsltParams.library_name + "?a=d&ftoc=" + (enabled ? "1" : "0") + "&c=" + gs.cgiParams.c;
1246
1247 $.ajax(url);
[26226]1248}
1249
[26397]1250/********************
1251* SLIDESHOW SCRIPTS *
1252********************/
1253
[26203]1254function showSlideShow()
1255{
[26305]1256 if(!($("#gs-slideshow").length))
[26203]1257 {
[26390]1258 var slideshowDiv = $("<div>", {id:"gs-slideshow", style:"height:100%;"});
[26305]1259 var loadingImage = $("<img>", {src:gs.imageURLs.loading});
1260 slideshowDiv.append(loadingImage);
1261
1262 $.blockUI({message: $(slideshowDiv), css:{top: "5%", left: "5%", width: "90%", height: "90%", overflow: "auto", cursor: "auto"}});
1263
1264 retrieveImagesForSlideShow(function(imageIDArray)
[26203]1265 {
[26305]1266 loadingImage.hide();
1267 if(imageIDArray && imageIDArray.length > 0)
[26203]1268 {
[26305]1269 var imageURLs = new Array();
1270 for(var i = 0; i < imageIDArray.length; i++)
[26203]1271 {
[26305]1272 if(imageIDArray[i].source && imageIDArray[i].source.search(/.*\.(gif|jpg|jpeg|png)$/) != -1)
[26203]1273 {
[26305]1274 imageURLs.push(gs.collectionMetadata.httpPath + "/index/assoc/" + gs.documentMetadata.assocfilepath + "/" + imageIDArray[i].source);
[26203]1275 }
1276 }
[26305]1277 new SlideShowWidget(slideshowDiv, imageURLs, imageIDArray);
1278 }
1279 });
[26203]1280 }
1281 else
1282 {
[26305]1283 $("#gs-slideshow").show();
[26203]1284 }
1285}
1286
1287function retrieveImagesForSlideShow(callback)
1288{
1289 var template = "";
1290 template += '<xsl:template match="/">';
1291 template += '<images>[';
1292 template += '<xsl:for-each select="//documentNode">';
1293 template += '<xsl:text disable-output-escaping="yes">{"source":"</xsl:text><gsf:metadata name="Source"/><xsl:text disable-output-escaping="yes">",</xsl:text>';
1294 template += '<xsl:text disable-output-escaping="yes">"id":"</xsl:text><xsl:value-of select="@nodeID"/><xsl:text disable-output-escaping="yes">"}</xsl:text>';
1295 template += '<xsl:if test="position() != count(//documentNode)">,</xsl:if>';
1296 template += '</xsl:for-each>';
1297 template += ']</images>';
1298 template += '</xsl:template>';
1299
1300 var url = gs.xsltParams.library_name + "/collection/" + gs.cgiParams.c + "/document/" + gs.cgiParams.d + "?ed=1&ilt=" + template.replace(" ", "%20");
1301
1302 $.ajax(
1303 {
1304 url:url,
1305 success: function(data)
1306 {
1307 var startIndex = data.indexOf(">", data.indexOf(">") + 1) + 1;
1308 var endIndex = data.lastIndexOf("<");
1309 var arrayString = data.substring(startIndex, endIndex);
1310 var imageIDArray = eval(arrayString);
1311
1312 callback(imageIDArray);
1313 }
1314 });
1315}
1316
1317function SlideShowWidget(mainDiv, images, idArray)
1318{
1319 var _inTransition = false;
1320 var _images = new Array();
1321 var _mainDiv = mainDiv;
[26390]1322 var _imageDiv = $("<div>", {id:"ssImageDiv", style:"height:95%; overflow:auto;"});
1323 var _navDiv = $("<div>", {style:"height:5%;"});
[26203]1324 var _nextButton = $("<img>", {src:gs.imageURLs.next, style:"float:right; cursor:pointer;"});
[26282]1325 var _prevButton = $("<img>", {src:gs.imageURLs.prev, style:"float:left; cursor:pointer; display:none;"});
[26305]1326 var _closeLink = $("<a href=\"javascript:$.unblockUI()\">Close Slideshow</a>");
[26203]1327 var _clearDiv = $("<div>", {style:"clear:both;"});
1328 var _currentIndex = 0;
1329
1330 _navDiv.append(_nextButton);
[26305]1331 _navDiv.append(_closeLink);
[26203]1332 _navDiv.append(_prevButton);
1333 _navDiv.append(_clearDiv);
1334 _mainDiv.append(_navDiv);
1335 _mainDiv.append(_imageDiv);
1336
1337 for(var i = 0; i < images.length; i++)
1338 {
1339 _images.push($("<img>", {src:images[i], "class":"slideshowImage"}));
1340 }
1341
[26282]1342 if(_images.length < 2)
1343 {
1344 _nextButton.css("display", "none");
1345 }
1346
[26203]1347 _imageDiv.append(_images[0]);
1348
1349 this.nextImage = function()
1350 {
1351 if(!_inTransition)
1352 {
1353 _inTransition = true;
1354 if((_currentIndex + 1) < _images.length)
1355 {
[26282]1356 _prevButton.css("display", "");
1357 if(_currentIndex + 1 == _images.length - 1)
1358 {
1359 _nextButton.css("display", "none");
1360 }
1361
[26305]1362 _imageDiv.fadeOut(500, function()
[26203]1363 {
1364 _imageDiv.empty();
1365 _imageDiv.append(_images[_currentIndex + 1]);
1366 _currentIndex++;
[26305]1367 _imageDiv.fadeIn(500, function()
[26203]1368 {
1369 _inTransition = false;
1370 });
1371 });
1372 }
1373 else
1374 {
1375 _inTransition = false;
1376 }
1377 }
1378 }
1379
1380 this.prevImage = function()
1381 {
1382 if(!_inTransition)
1383 {
1384 _inTransition = true;
1385 if((_currentIndex - 1) >= 0)
1386 {
[26282]1387 _nextButton.css("display", "");
1388 if(_currentIndex - 1 == 0)
1389 {
1390 _prevButton.css("display", "none");
1391 }
1392
[26305]1393 _imageDiv.fadeOut(500, function()
[26203]1394 {
1395 _imageDiv.empty();
1396 _imageDiv.append(_images[_currentIndex - 1]);
1397 _currentIndex--;
[26305]1398 _imageDiv.fadeIn(500, function()
[26203]1399 {
1400 _inTransition = false;
1401 });
1402 });
1403 }
1404 else
1405 {
1406 _inTransition = false;
1407 }
1408 }
1409 }
1410
1411 var getRootFilenameFromURL = function(url)
1412 {
1413 var urlSegments = url.split("/");
1414 var filename = urlSegments[urlSegments.length - 1];
1415 return filename.replace(/_thumb\..*$/, "");
1416 }
1417
1418 var setLink = function(currentLink, index)
1419 {
1420 $(currentLink).click(function()
1421 {
1422 _inTransition = true;
1423 _currentIndex = index;
[26305]1424 _imageDiv.fadeOut(500, function()
[26203]1425 {
1426 _imageDiv.empty();
1427 _imageDiv.append(_images[_currentIndex]);
[26305]1428 _imageDiv.fadeIn(500, function()
[26203]1429 {
1430 _inTransition = false;
1431 });
1432 });
1433 });
1434 }
1435
1436 var sliderLinks = $(".pageSliderCol a");
1437 for(var i = 0; i < sliderLinks.length; i++)
1438 {
1439 var currentLink = sliderLinks[i];
1440 var id = $(currentLink).attr("href").split("'")[1];
1441
1442 for(var j = 0; j < idArray.length; j++)
1443 {
1444 if(idArray[j].id == id)
1445 {
1446 var image = idArray[j].source;
1447
1448 for(var l = 0; l < images.length; l++)
1449 {
1450 var filename = getRootFilenameFromURL(images[l]);
1451 if (filename == image)
1452 {
1453 setLink(currentLink, l);
1454 break;
1455 }
1456 }
1457
1458 break;
1459 }
1460 }
1461 }
1462
1463 _nextButton.click(this.nextImage);
1464 _prevButton.click(this.prevImage);
[24467]1465}
Note: See TracBrowser for help on using the repository browser.