HEX
Server: Apache/2.4.34 (Red Hat) OpenSSL/1.0.2k-fips
System: Linux WORDPRESS 3.10.0-1160.118.1.el7.x86_64 #1 SMP Thu Apr 4 03:33:23 EDT 2024 x86_64
User: digital (1020)
PHP: 7.2.24
Disabled: NONE
Upload Files
File: /datos/www/www.colombia.co/public_html/wp-content/plugins/playbuzz/js/pb-global.js
/**
 *
 * @param pb
 * @param jQuery
 * @constructor
 */

function PbGlobal(pb, jQuery, settings) {

    this.$ = jQuery;
    this.global = this.$.extend({}, pb);
    this.toBool = 'comments,info,shares';
    this.settings = settings;

    //add settings from url to global object
    this.enrich(this.global);

    //normalize the global object
    this.normalize(this.global);

    this.global.setItemId = function setItemId(itemId) {
        window.pb.itemId = itemId;
    };

    return this.global;
}

PbGlobal.prototype.enrich = function(global){

    global.options = this.$.extend(this.settings, global.options);

    return global;
};

/**
 * normalize global object properties
 * @param global
 * @returns {*}
 */
PbGlobal.prototype.normalize = function (global) {

    var _this = this;

    global.options = parser(global.options);

    return global;


    function parser(obj) {
        for(var key in obj){

            if(_this.toBool.indexOf(key) > -1 ){
                obj[key] =  Boolean(obj[key]);
            }
        }

        return obj;

    }

};

window.PbGlobal = PbGlobal;