PageSourceSearch

https://www.thesecondevolution.com/wp-content/plugins/font/js/pluginscripts.js?pver=7.5

js thesecondevolution.com collected 2026-10-02 13:32:59 UTC 11,465 bytes, 270 lines download raw bytes

1// JavaScript Document
2jQuery(document).ready(function () {
3    clearInterval(documentLoaded);
4    // if there's no "draggable" then something's wrong so load provided jquery ui
5    if(!jQuery.fn.fontPlugin || !jQuery.ui || !jQuery.ui.draggable || !jQuery.fn.on) {
6        engageCompatibilityMode();
7    } else {
8        fQuery = jQuery;
9        initializeFontPlugin();
10    }
11});
12// this won't run unless jquery is completely overwritten by some plugin
13var documentLoaded = setInterval(function () {
14    if(document.readyState === "complete") {
15        engageCompatibilityMode();
16        // stop checking if the document is laoded
17        clearInterval(documentLoaded);
18    }
19}, 100);
20
21function engageCompatibilityMode (callback, e) {
22    if(e !== undefined) {
23        alert('compatibility mode: ' + e.message);
24    }
25    jQuery.getScript(fontBlogUrl + '/wp-content/plugins/font/js/jquery-1.10.2.min.js', function () {
26        fQuery = jQuery.noConflict(true);
27        fQuery.getScript(fontBlogUrl + '/wp-content/plugins/font/js/jquery-ui-1.9.2.custom.min.js', function () {
28            fQuery.getScript(fontBlogUrl + '/wp-content/plugins/font/js/colorpicker.js');
29            fQuery.getScript(fontBlogUrl + '/wp-content/plugins/font/js/jquery.fcarousel.min.js');
30            fQuery.getScript(fontBlogUrl + '/wp-content/plugins/font/js/jquery.fontPlugin.js', function () {
31                initializeFontPlugin(true);
32                if(callback !== undefined) {
33                    callback();
34                }
35            });
36        });
37    });
38}
39
40function initializeFontPlugin (compatibilityMode) {
41    if(compatibilityMode === undefined) {
42        compatibilityMode = false;
43    }
44    /*
45    show font plugin browser BUTTON
46    */
47    fQuery('#FFW_chooseFontButton, #content_FFWButton, #wp-admin-bar-font_settings > a').bind('click', function (e) {
48        e.preventDefault();
49
50        //if initialized already just toggle
51        if (fQuery('#fontplugin')[0] && fQuery('#fontplugin').data('fontPlugin') && fQuery('#fontplugin').data('fontPlugin').$presets) {
52            fQuery('#fontplugin').data('fontPlugin').$presets.fadeToggle(500);
53        } else {
54            if(compatibilityMode) {
55                //alert('WARNING: Font plugin is running in safe mode. \n\n It may not work correctly! \n\nWhy?\n\nThis is usually caused by a conflict with a poorly written plugin.\n\n Try disabling all other plugins and then see if Font plugin starts without this message. If that works, enable other plguins one by one to find the one, which is causing the conflict.');
56            }
57            window.onbeforeunload = function () {
58                return 'Have you saved the changes?';
59            };
60
61            //open jquery plugin
62            var fontPluginWrapper = fQuery('<div id="fontplugin" class="draggableModal"></div>'),
63                settings;
64            fontPluginWrapper.appendTo('body');
65            settings = {
66                "compatibilityMode" : compatibilityMode,
67                "settingFields": [
68                    {
69                        "type": "text",
70                        "label": "Selector",
71                        "name": "selector",
72                        "settingType": "general",
73                        "settingName": "selector",
74                        "extendWith": "selectorPicker"
75                    },
76                    {
77                        "type": "text",
78                        "label": "Font size",
79                        "name": "font-size",
80                        "settingType": "css",
81                        "settingName": "fontSize",
82                        "extendWith": "slider",
83                        "unit": "px"
84                    },
85                    {
86                        "type": "text",
87                        "label": "Color",
88                        "name": "color",
89                        "settingType": "css",
90                        "settingName": "color",
91                        "extendWith": "colorPicker"
92                    }]
93            };
94            if(!fQuery.fontPlugin) {
95                fQuery.fn.fontPlugin = fontPlugin;
96            }
97
98            try {
99                fontPluginWrapper.fontPlugin(settings);                
100            } catch (e) {
101                console.dir(e);
102                alert('The plugin cannot start because of an error. This is usually caused by a conflict with a poorly written plugin or a theme overwriting jQuery. Try disabling all other plugins and then see if the "Font" plugin works. If that works, enable them one by one to find the one, which is causing the conflict. If nothing helps copy this error and send to the plugin author: ' + e);
103            }
104        }
105        return false;
106    });
107    
108    // extend with object size
109    if(!Object.size) {
110        Object.size = function(obj) {
111            var size = 0, key;
112            for (key in obj) {
113                if (obj.hasOwnProperty(key)) size++;
114            }
115            return size;
116        };
117    }
118    //make image colorpickable
119    /*function makeImagesColorpickable() {
120        var image = fQuery("#header1preview").contents().find('img');
121        fQuery("#header1preview").contents().find('a').click(function () {
122            return false;
123        });
124        image.click(function (e) {
125            var img = new Image(),
126                canvas,
127                context,
128                posX,
129                posY,
130                x,
131                y,
132                data,
133                color;
134            img.src = fQuery(this).attr('src');
135            canvas = fQuery('<canvas id="canvas" style="display:none"></canvas>');
136            canvas[0].setAttribute('width', fQuery(this).width());
137            canvas[0].setAttribute('height', fQuery(this).height());
138            fQuery('body').append(canvas);
139            context = document.getElementById('canvas').getContext('2d');
140            context.drawImage(img, 0, 0);
141            posX = fQuery(this).offset().left;
142            posY = fQuery(this).offset().top;
143            x = Math.round(e.pageX - posX);
144            y = Math.round(e.pageY - posY);
145            data = context.getImageData(x, y, 1, 1).data;
146            color = dec2html(data[0]) + dec2html(data[1]) + dec2html(data[2]);
147            ffwSetFontColor('#' + color);
148            return false;
149        });
150        //calculating functions
151        function dec2html(d) {
152            // Converts from decimal color value (0-255) to HTML-style (00-FF)
153            var hch = "0123456789ABCDEF",
154                a = d % 16,
155                b = (d - a) / 16;
156            return hch.charAt(b) + hch.charAt(a);
157        }
158    }*/
159    // Escape regex chars with \
160    RegExp.escapeX = function (text) {
161        return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
162    };
163    // The style function
164    fQuery.fn.style = function (styleName, value, priority) {
165        //console.log(styleName + ' - ' + value + ' - ' + priority);
166        var node,
167            style;
168        // For those who need them (< IE 9), add support for CSS functions
169        if (!CSSStyleDeclaration.prototype.getPropertyValue || !CSSStyleDeclaration.prototype.setProperty) {
170            CSSStyleDeclaration.prototype.getPropertyValue = function (a) {
171                return this.getAttribute(a);
172            };
173            CSSStyleDeclaration.prototype.setProperty = function (styleName, value, priority) {
174                var rule;
175                priority = typeof priority !== undefined ? priority : '';
176                this.setAttribute(styleName, value);
177                if (priority !== '') {
178                    // Add priority manually
179                    rule = new RegExp(RegExp.escapeX(styleName) + '\\s*:\\s*' + RegExp.escapeX(value) + '(\\s*;)?', 'gmi');
180                    this.cssText = this.cssText.replace(rule, styleName + ': ' + value + ' !' + priority + ';');
181                }
182            };
183            CSSStyleDeclaration.prototype.removeProperty = function (a) {
184                return this.removeAttribute(a);
185            };
186            CSSStyleDeclaration.prototype.getPropertyPriority = function (styleName) {
187                var rule = new RegExp(RegExp.escapeX(styleName) + '\\s*:\\s*[^\\s]*\\s*!important(\\s*;)?', 'gmi');
188                return rule.test(this.cssText) ? 'important' : '';
189            };
190        }
191        function camelToDash(str) {
192            return str.replace(/\W+/g, '-')
193                .replace(/([a-z\d])([A-Z])/g, '$1-$2');
194        }
195        styleName = camelToDash(styleName);
196        // DOM node
197        node = this.get(0);
198        // Ensure we have a DOM node
199        if (typeof node === 'undefined') {
200            return;
201        }
202        // CSSStyleDeclaration
203        style = this.get(0).style;
204        // Getter/Setter
205        if (styleName !== undefined) {
206            if (value !== undefined) {
207                // Set style property
208                priority = priority !== undefined ? priority : '';
209                //console.log(styleName + ', ' + value + ', ' + priority)
210                style.setProperty(styleName, value, priority);
211            } else {
212                // Get style property
213                return style.getPropertyValue(styleName);
214            }
215        } else {
216            // Get CSSStyleDeclaration
217            return style;
218        }
219    };
220    if(!fQuery.fn.inlineStyle) {
221        fQuery.fn.inlineStyle = function (prop) {
222            return this.prop("style")[fQuery.camelCase(prop)];
223        };
224    }
225    (function ($) {
226        $.fn.removePrefixedClasses = function (prefix) {
227            if(!$(this).attr('class')) return;
228            var classNames = $(this).attr('class').split(' '),
229                className,
230                newClassNames = [],
231                i;
232            //loop class names
233            for(i = 0; i < classNames.length; i++) {
234                className = classNames[i];
235                // if prefix not found at the beggining of class name
236                if(className.indexOf(prefix) !== 0) {
237                    newClassNames.push(className);
238                    continue;
239                }
240            }
241            // write new list excluding filtered classNames
242            $(this).attr('class', newClassNames.join(' '));
243        };
244    }(fQuery));
245    
246    if(!fQuery.fn.animateRotate) {
247        fQuery.fn.animateRotate = function(angle, duration, easing, complete) {
248            return this.each(function() {
249                var $elem = fQuery(this);
250                var currentRotationAngle = $elem.data('rotation');
251                if(currentRotationAngle === undefined) {
252                    currentRotationAngle = 0;
253                }
254                $elem.data('rotation', angle);
255
256                fQuery({deg: currentRotationAngle}).animate({deg: angle}, {
257                    duration: duration,
258                    easing: easing,
259                    step: function(now) {
260                        
261                        $elem.css({
262                            transform: 'rotate(' + now + 'deg)'
263                        });
264                    },
265                    complete: complete || fQuery.noop
266                });
267            });
268        };
269    }
270}

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.