PageSourceSearch

https://thalesdocs.com/dpod/services/luna_cloud_hsm/theme/js/lightbox_fancy.js

js thalesdocs.com collected 2026-09-24 08:49:16 UTC 1,935 bytes, 54 lines download raw bytes

1/* to simplify this for techwriters, if they tag an image source with {: lightbox }
2   this js will create the appropriate/required div to perform lightbox functions */
3
4/* REQUIRES: fancybox (fancybox.net) */
5
6jQuery(document).ready(function ($) {
7    //Which target to put the lightboxes in
8    // Body
9    var main = $('body');
10
11    //or after main
12    // put all light box divs after main
13    //var main = document.getElementsByTagName('main');
14    //console.log(main);
15
16    // Find all images to process and run insertLightbox
17    var arr_p_wrappers = $(main).find("p.lightbox");
18    //console.log(arr_p_wrappers);
19
20    // Process and run insertLightbox
21    $.each(arr_p_wrappers, function (i, rowValue) {
22        /* console.log(i + ": " + rowValue); */
23        insertLightbox(rowValue, main);
24
25    });
26
27    /* insertLightbox
28       This function does two important things.
29       1. it wraps the img tag within a p tag (markdown inserted it) so that we have something to click
30       2. it inserts a div after main with the target lightbox image
31    */
32    function insertLightbox(p_wrapper, target) {
33        console.log('insertLightbox');
34        console.log(p_wrapper);
35
36        var target_id = $(p_wrapper).attr('id');
37        console.log("p_id: " + target_id);
38        var target_img = $(p_wrapper).find("img");
39        console.log("p_id img: " + target_img);
40
41        var target_img_src=$(target_img).attr('src');
42        console.log("img_src: " + target_img_src);
43
44        /* 
45        <a id="single_image" href="image_big.jpg"><img src="image_small.jpg" alt=""/></a>
46        */
47        var lightbox_a_wrapper = '<a id="single_image" href="' + target_img_src + '"></a>';
48        console.log("a_wrapper: "+lightbox_a_wrapper);
49        $(p_wrapper).find("img").wrap(lightbox_a_wrapper);
50
51        // We need to make sure the paragraph id that we used to track is removed
52        /* $(p_wrapper).removeAttr('id'); */
53    }
54});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.