PageSourceSearch

https://ameliab.com/_jsapps/rail/rail.jquery.js

js ameliab.com collected 2026-10-05 05:51:14 UTC 2,827 bytes, 107 lines download raw bytes

1
2
3
4/*
5 *  Start this backbone application 
6 *  Set the jquery dragging
7 *  Hijack the following icon click
8 */
9Cargo.Rail = {
10
11    Data : {
12        "dragging"      : false,
13        "is_saving"     : false,
14        "is_on_screen"  : false
15    },
16
17    Init : function() {
18
19        /*
20         *  Set the backbone view for the master
21         */
22        new Cargo.app.Rail.View.Master({ 
23            el : "#rail_wrapper"
24        });
25
26        /* 
27         *  Following icon
28         */
29        $("#toolset_follow_pair a, #toolset_follow a").click(function(e) {
30            e.preventDefault();
31            Cargo.app.Rail.Events.trigger("show_rail_following");
32            return false;
33        });
34
35        /*
36         *  Dragging and dropping
37         */
38        var setDrag = function() {
39            // Disallow on mobile
40            var is_mobile = (typeof Cargo.Helper == "object") ? Cargo.Helper.isMobile() : Cargo.Config.isMobile();
41            if(is_mobile) {
42                return false;
43            }
44            
45            // Firefox/IE anchor img slideshow
46            if ( $.browser.mozilla || $.browser.msie ) {
47                $(".project_content a:has(img[data-mid]), #container a:has(img[data-mid])").dragstart(function(e) {
48                    Cargo.Rail.Drag($("img:visible", this));
49                });
50            }
51
52            // Configure the drag for all other images
53            $("img[data-mid]").dragstart(function(e) {
54                // console.log("Dragging starting");
55                Cargo.Rail.Drag($(this));
56
57            }).dragend(function(e) {
58
59                // Delay unless in webkit
60                if ( $.browser.mozilla || $.browser.msie ) {
61                    setTimeout(function() { Cargo.Rail.Data.dragging = false }, 100);
62                } else {
63                    Cargo.Rail.Data.dragging = false
64                }
65
66            });
67        }
68
69        /**
70         * Bind to events
71         */
72
73        $(document).bind("projectLoadComplete", function(e, pid) {
74            Cargo.app.Rail.Events.trigger("rail:hide");
75            setDrag();
76        });
77
78        $(document).bind("projectLoadComplete", function(e, pid) {
79            setDrag();
80        });
81
82        $(document).bind("projectIndex", function(e, pid) {
83            Cargo.app.Rail.Events.trigger("rail:hide");
84        });
85
86        $(document).bind("paginationComplete", function(e, data) {
87            setDrag();
88        });
89
90        setDrag();
91    },
92
93    Drag : function(element) {
94
95        Cargo.Rail.Data.dragging = true;
96
97        Cargo.app.Rail.Events.trigger("image_drag_start");
98
99        // Set the value of the dragged element in the model
100        Cargo.app.Rail.Model.SelectionsModel.set({
101             src : $(element).attr('src'),
102             mid : $(element).attr('data-mid')
103        });
104
105    }
106    
107};

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.