PageSourceSearch

http://www.cagpo.ca/Ext/Resources?a=hJmCe_9dy7ejE6FDFWmdObo8wd1vez…UCo72DimSgmrYjqC5YYMyK1yq1-Joc5xljFNFKOiIoe

js cagpo.ca collected 2026-10-01 00:58:00 UTC 4,748 bytes, 140 lines download raw bytes

1
2WS.Namespace.Create('WS.CaptionManager.UI', (function ()
3{
4    /**
5    note : element parent must be relative
6
7
8    @class CaptionManager.UI
9    @namespace WS
10    @constructor 
11    @param {Object} element Element for which the caption will show up
12    @param {Object} parentelement Element Parent for which the caption will show up
13    @param {Object} params Caption must have a title or descr, if both null, exception will be thrown.
14    @param {String} params.Title
15    @param {String} params.Descr
16    @param {Number} params.Pos (Top, Bottom)
17    @param {Number} params.Align (Left, Center, Right)
18    @param {Boolean} params.AffHover Show onOver or Always showing
19    **/
20    var Class = function (element, parentelement, params)
21    {
22        // Validation
23        if (!element || element.length == 0) throw "element invalid!";
24        if (!parentelement || parentelement.length == 0) throw "parentelement invalid!";
25        if (!params.Title && !params.Descr) throw "title and descr not found!";
26
27        this.container = parentelement;
28        this.element = element;
29        this.params = params;
30
31        var Html = [];
32        Html.push("<div class=\"wsCaptionManager\">");
33        Html.push("<div>");
34        Html.push("<span></span>");
35        Html.push("<span></span>");
36        Html.push("</div>");
37        Html.push("</div>");
38        this.Caption = $(Html.join(""));
39
40        // AddHover 
41        if (this.params.AffHover) AddOver.apply(this);
42
43        // Bind Data
44        Bind.apply(this);
45
46        // append caption to container element
47        this.container.append(this.Caption);
48
49        // if no AddedHover
50        if (!this.params.AffHover) ShowCaption.apply(this);
51    };
52
53    // Private Method(s)
54    var ShowCaption = function ()
55    {
56        this.Caption.css("bottom", "");
57        this.Caption.css("top", "");
58
59        var Width = (this.container.outerWidth(true) < this.element.outerWidth(true)) ? this.container.outerWidth(true) : (this.element.outerWidth(false));
60        this.Caption.css({ "width": Math.round(parseFloat(Width)) + "px" });
61
62
63        if (this.params.Pos == "Bottom")
64        {
65            var Top = (parseInt(this.element.css("margin-top")) == 0 || this.element.css("margin-top") == "") ? this.element.position().top : this.element.css("margin-top");
66            var Bottom = (parseInt(Top) + this.element.outerHeight(true)) - this.Caption.outerHeight(true);
67            if (this.container.outerHeight(true) < this.element.outerHeight(true)) this.Caption.css("bottom", "0px");
68            else this.Caption.css("top", Math.round(Bottom) + "px");
69        }
70        else
71        {
72            var Top = (parseInt(this.element.css("margin-top")) == 0) ? this.element.position().top : this.element.css("margin-top");
73            if (this.container.outerHeight(true) < this.element.outerHeight(true)) Top = 0;
74            this.Caption.css("top", Math.round(parseFloat(Top)) + "px");
75        }
76        this.Caption.removeClass("wsActive").addClass("wsActive");
77    };
78
79    var AddOver = function ()
80    {
81        var Me = this;
82
83        this.Caption.removeClass("wsActive");
84        this.Caption.mouseover(function () { ShowCaption.apply(Me); });
85        this.Caption.mouseout(function () { Me.Caption.removeClass("wsActive") });
86        this.element.mouseover(function () { ShowCaption.apply(Me); });
87        this.element.mouseout(function () { Me.Caption.removeClass("wsActive") });
88    };
89
90    var Bind = function ()
91    {
92        // Title, Descr
93        var Wrapper = this.Caption.find("div");
94        var Title = this.Caption.find("div > span:first-child");
95        var Descr = this.Caption.find("div > span:last-child");
96        if (this.params.Title) Title.text(this.params.Title);
97        if (this.params.Descr) Descr.text(this.params.Descr);
98
99        //params.align // text align in box
100        Wrapper.addClass("ws" + this.params.Align);
101    };
102
103    // Public Method(s)
104    (function (Methods)
105    {
106        /**
107        Remove the Caption
108        
109        @method Remove
110        **/
111        Methods.Remove = function ()
112        {
113            this.Caption.remove();
114        };
115
116        /**
117        Hide the caption
118       
119        @method Hide
120        **/
121        Methods.Hide = function ()
122        {
123            this.Caption.removeClass("wsActive");
124        };
125
126        /**
127        Re-Calculate positions and display caption
128        if necessary
129
130        @method Bind
131        **/
132        Methods.Bind = function ()
133        {
134            if (!this.params.AffHover) ShowCaption.apply(this);
135        };
136
137    })(Class.prototype);
138
139    return Class;
140})());

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.