PageSourceSearch

https://www.dukesynthesis.com/Ext/Resources?a=bvYs0aOEOUIk3qjg__c8…74LUEPQZtTwomg0BGmq_dOzhBEYLfx9rmRtRFNrhPA,

js dukesynthesis.com collected 2026-09-28 01:07:53 UTC 4,742 bytes, 153 lines download raw bytes

1/**
2Represents one content.
3**/
4var Content = (function ()
5{
6    /**
7    Content.
8    @class Content
9    @constructor
10    @param {jQuery dom} element Dom element that represents a content wrapper.
11    **/
12    var _class = function (element)
13    {
14        // EVENT (DOM READY FOR PUSHING ENGINE)
15        WS.EventObject.call(this, ["dom_ready"]);
16
17        this.ContentType = element.attr("class").match(/Type_([^\s]*)/i)[1];
18        this.Element = element;
19        this.InBodyWrapper = element.closest("#BodyWrapper").length == 1;
20
21        if (window.WS.IsMobile && this.ContentType === "Image")
22        {
23            this.InitialSize = {};
24            this.InitialSize.Width = element.width();
25            this.InitialSize.Height = element.height();
26        }
27
28        if (window.WS.IsMobile && this.ContentType.toLowerCase() === "slideshow")
29        {
30            element.addClass("wsMobile");
31        }
32
33        var isScalableTextType = this.ContentType === "Text" || this.ContentType === "Title" || this.ContentType === "Button";
34        var Me = this;
35
36        var OnContentLoaded = function () {
37            if (Me.ContentType === "Button") {
38                this.Update();
39
40                // "Arrow" buttons text cannot be multiplied.
41                isScalableTextType = !IsSvgButton.call(Me.Element);
42                if (isScalableTextType) {
43                    Me.Element.addClass('ScalableButton');
44                    if (window.WS.IsMobile) window.setTimeout(function () { Me.RaiseEvent("dom_ready", Me.Element); }, 5000);
45                }
46            }
47
48            // For scalable types, we must set the font size of each child element.
49            if (isScalableTextType) {
50                ApplyMultiplier.call(Me, element, parseFloat(element.attr('multiplier').replace(',', '.')));
51            }
52        };
53
54        this.ContentLoader = new ContentLoader(element, null, window.WS.IsMobile ? OnContentLoaded : null);
55    };
56
57    WS.Exts.Inherits(_class, WS.EventObject);
58
59    // Public Method(s)
60    (function (Methods)
61    {
62        /**
63        Resizes the content to better fit the available space.
64
65        @method Resize
66        **/
67        Methods.Resize = function ()
68        {
69            if (this.ContentType === "Image")
70            {
71                AdjustImageSize.call(this, this.Element);
72                this.ContentLoader.Update();
73            }
74        };
75
76        Methods.InBody = function ()
77        {
78            return this.InBodyWrapper;
79        };
80
81    })(_class.prototype);
82
83    // Private methods
84
85    /**
86    Checks if the button is an ssvg child.
87
88    @method IsSvgButton
89    **/
90    var IsSvgButton = function ()
91    {
92        return this.find('svg').length > 0;
93    }
94
95    /**
96    Apply the font multiplier on each text element of the current element.
97    
98    @method ApplyMultiplier
99    **/
100    var ApplyMultiplier = function (element, Multiplier)
101    {
102        var elements = element.find(".Block_Wrapper > :first *"); // all elements within the wrapper
103        var elementsLen = elements.length;
104        for (var i = elementsLen; i > 0; i--)
105        {
106            var e = elements.eq(i - 1);
107            e.css("font-size", GetMultipliedFontSize(e, Multiplier));
108        }
109
110        this.ContentLoader.Update();
111    };
112
113    /**
114    Gets a font size resulting from a multiplier and the default font size of an element.
115    **/
116    var GetMultipliedFontSize = function (element, Multiplier)
117    {
118        var defaultFontSize = element.css('font-size').replace('px', '');
119        return defaultFontSize * Multiplier + "px";
120    };
121
122    /**
123    Adjusts the size of an image to either fit horizontally, or be centered.
124    
125    @method AdjustImageSize
126    @param {Content} content Content which type is Image.
127    **/
128    var AdjustImageSize = function (content)
129    {
130        var availableWidth = $("#BodyWrapper .Zone").width();
131
132        // If the image is larger than the available width: make it fit.
133        if (this.InitialSize.Width > availableWidth)
134        {
135            var width = this.InitialSize.Width;
136            var height = this.InitialSize.Height;
137            var ratio = availableWidth / width;
138
139            width = Math.round(width * ratio);
140            height = Math.round(height * ratio);
141
142            content.css('width', width + "px");
143            content.css('height', height + "px");
144        }
145        else
146        {
147            // Image is smaller than the available width: we center it
148            content.css('margin-left', (availableWidth - this.InitialSize.Width) / 2);
149        }
150    };
151
152    return _class;
153})();

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.