HEX
Server: Apache
System: Linux nc-ph-4101.simplemoneygoals.com 5.14.0-503.21.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Sun Jan 12 09:45:05 EST 2025 x86_64
User: dailygoldindex (1004)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: /home/dailygoldindex/public_html/wp-content/themes/jnews/assets/js/admin/shortcode-generator.js
!function(t,e){"use strict";e.shortcodepopup=new e.Values({defaultConstructor:e.ShortCodeListPopup}),e.shortcodecontainer=new e.Values({defaultConstructor:e.ShortCodeContainer}),e.ShortCodeContainer=e.BaseContainer.extend({setContainerHolder:function(){this.containerHolder=e.shortcodecontainer},attachEvent:function(){t(this.element).formtab()},prepareSegmentData:function(t,e,n){return t.parent=this.id,t.container=this,t.type="tabbed",t.index=n,t},prepareFieldData:function(t,e,n){return t.container=this,t.index=n,t}}),e.ShortCodeItem=e.Class.extend({id:null,data:null,element:null,container:null,popupContainer:null,initialize:function(e,n){this.id=e,this.data=n,this.popupContainer=t(".shortcode-option-wrapper"),this.renderItem(),this.attachEvent()},renderItem:function(){var e=wp.template("shortcode-item");this.element=t(e({id:this.id,name:this.data.name})),this.container=this.data.parent.container.find("[id="+this.data.category+"] .jeg_metabox_body"),this.container.append(this.element)},attachEvent:function(){this.element.on("click",this.showShortCodeOptionWindow.bind(this))},showShortCodeOptionWindow:function(){e.shortcodepopup.instance("jnews").hidePopup(),this.setupPopup()},setupPopup:function(){this.renderPopup(),this.showPopup(),this.resetPosition(),this.renderShortCodeOption()},resetPosition:function(){var e=t(window).height(),n=t(window).width(),o=Math.floor(80*n/100);o=o>750?750:o;var i=Math.floor(80*e/100),a=(n-o)/2,r=(e-(i=i>700?700:i))/2;this.popupContainer.css({width:o,height:i,top:r,left:a});var s=this.popupContainer.find(".popup-header").outerHeight()+this.popupContainer.find(".tabbed-list").outerHeight()+this.popupContainer.find(".popup-footer").outerHeight();this.popupContainer.find(".popup-content").css({height:i-s})},renderPopup:function(){this.popupContainer.html("");var t=wp.template("shortcode-option")({header:this.data.name,close:window.jnews.close,generate:window.jnews.generate});this.popupContainer.append(t),this.attachPopupEvent()},attachPopupEvent:function(){var e=this;this.popupContainer.find(".close").on("click",e.hidePopup.bind(e)),this.popupContainer.find(".generate").on("click",e.generateShortcode.bind(e)),this.popupContainer.draggable({handle:".popup-header",start:function(){t(".iconpicker-popover").remove()}})},showPopup:function(){this.popupContainer.addClass("active")},hidePopup:function(){this.popupContainer.removeClass("active")},renderShortCodeOption:function(){this.loadAjax().done(this.shortCodeOptionLoaded.bind(this))},loadAjax:function(){return wp.ajax.send(this.id,{data:{nonce:window.jnews.nonce}})},shortCodeOptionLoaded:function(t){var n=this;e.shortcodecontainer.has(n.id)&&e.shortcodecontainer.remove(n.id),e.shortcodecontainer.add(n.id,new e.ShortCodeContainer(n.id,n.popupContainer,t)),n.resetPosition()},generateShortcode:function(){var t=this,n=e.shortcodecontainer.instance(t.id),o=[];n.segments.each((function(e){e.fields.each((function(e){var n=e.value.get();e.params.default!=n&&(n=t.filterValue(n),o.push(e.id+'="'+n+'"'))}))})),o="["+t.id+" "+o.join(" ")+"]",t.data.editor.execCommand("mceInsertContent",!1,o),t.hidePopup()},filterValue:function(t){return t}}),e.ShortCodeCategory=e.Class.extend({id:null,index:0,data:null,initialize:function(t,e,n){this.id=t,this.data=n,this.index=e,this.renderCategory()},renderCategory:function(){var t=this,e=this.data.parent.container,n={id:t.id,text:t.data.category,index:t.index},o=wp.template("shortcode-category-list")(n);e.find(".tabbed-list").append(o);var i=wp.template("shortcode-category")(n);e.find(".tabbed-body").append(i)}}),e.ShortCodeListPopup=e.Class.extend({editor:null,data:null,categories:null,items:null,container:null,initialize:function(n){this.editor=n,this.categories=new e.Values({defaultConstructor:e.ShortCodeCategory}),this.items=new e.Values({defaultConstructor:e.ShortCodeItem}),this.data=window.jnews,this.container=t(".shortcode-popup-list-wrapper"),this.setupPopup(),this.showPopup(),this.resetPosition(!0)},setupPopup:function(){this.setupContainer(),this.setupCategory(),this.setupElement(),this.attachEvent()},setupContainer:function(){var t=wp.template("shortcode-popup")({header:this.data.title});this.container.append(t)},attachEvent:function(){var e=this;this.container.find(".close").on("click",e.hidePopup.bind(e)),this.container.formtab(),this.container.draggable({handle:".popup-header"}),t(window).on("resize",e.resetPosition.bind(this))},resetPosition:function(){var e=t(window).height(),n=t(window).width(),o=Math.floor(80*n/100);o=o>1200?1200:o;var i=Math.floor(80*e/100),a=(n-o)/2,r=(e-(i=i>700?700:i))/2;this.container.css({width:o,height:i,top:r,left:a});var s=this.container.find(".popup-header").outerHeight()+this.container.find(".tabbed-list").outerHeight();this.container.find(".popup-content").css({height:i-s})},setupCategory:function(){var t=this,n=0;_.each(t.data.elements,(function(o){var i=t.slugify(o.category);t.categories.has(i)||t.categories.add(i,new e.ShortCodeCategory(i,n++,{category:o.category,parent:t}))}))},setupElement:function(){var t=this;_.each(t.data.elements,(function(n,o){t.items.add(o,new e.ShortCodeItem(o,{id:o,name:n.name,category:t.slugify(n.category),parent:t,editor:t.editor}))}))},showPopup:function(){this.container.addClass("active")},hidePopup:function(){this.container.removeClass("active")},slugify:function(t){return t.toString().toLowerCase().replace(/\s+/g,"-").replace(/[^\w\-]+/g,"").replace(/\-\-+/g,"-").replace(/^-+/,"").replace(/-+$/,"")}})}(jQuery,wp.customize);