diff --git a/assets/admin.css b/assets/admin.css index 2bb92bf..edd2e8b 100755 --- a/assets/admin.css +++ b/assets/admin.css @@ -1,2 +1,2 @@ -#customize-header-actions #sfp-skins-save-dialog{position:absolute;top:0;left:52px}#sfp-skins-apply-confirm,#sfp-skins-overlay,#sfp-skins-notice,#sfp-skins-dialog{position:fixed;top:0;left:0;right:0;bottom:0;margin:auto;background:rgba(0,0,0,0.5);z-index:97}#sfp-skins-apply-confirm{height:70px;width:520px;padding:1em;background:#fff;border:1px outset #aaa}#sfp-skins-apply-confirm button,#sfp-skins-apply-confirm p{margin:1em;float:right}#sfp-skins-notice{height:52px;width:520px;text-align:center;background:none}#sfp-skins-notice-message{padding:1em 1.6em;display:inline-block;font:200 25px lato, sans-serif;background:#0085ba;color:#fff;border-radius:99px}#sfp-skins-dialog{background:none;width:90vw;max-width:520px;height:120px;background:#fff;padding:0 16px}#sfp-skins-dialog header{padding:16px 16px 11px;font:300 16px sans-serif;background:#ddd;text-transform:uppercase;margin:0 -16px 16px}#sfp-skins-dialog header .dashicons-no{float:right;margin:-16px;padding:13px;cursor:pointer}#sfp-skins-dialog>input,#sfp-skins-dialog>button{text-align:center;line-height:35px;padding:0;margin:0;box-sizing:border-box;height:auto;box-shadow:none;float:left;width:21%;border-radius:0 5px 5px 0}#sfp-skins-dialog input{padding:0 0.5em;text-align:left;width:79%;border-radius:5px 0 0 5px}#sfp-skins-dialog .notice.already-exists{width:100%;position:absolute;bottom:124%;padding:1em;box-sizing:border-box;left:0;margin:0;border-radius:5px}#sfp-skins-dialog .notice.already-exists *{margin:0}#sfp-skins-dialog .notice.already-exists button{float:right}.no-skins{font-size:1.1em;color:#777}h3.sfp-skin-button{padding:1em;background:#fff;border:1px solid #ccc;cursor:pointer;opacity:0.88;position:relative;overflow:hidden}h3.sfp-skin-button:hover{opacity:1}h3.sfp-skin-button .sync,h3.sfp-skin-button .delete{position:absolute;top:50%;margin-top:-10px;right:0.5em}h3.sfp-skin-button .sync{background:inherit;right:1.6em;margin-top:-15px;padding:5px 0;transition:opacity 0.35s;opacity:0}h3.sfp-skin-button:hover .sync{opacity:1}h3.sfp-skin-button ~ .no-skins{display:none}#sfp-skins-actions{position:absolute;top:45px;left:0;right:0;border-top:1px solid #ccc;border-bottom:1px solid #ccc;padding:0 1em;display:none}#customize-header-actions+#sfp-skins-actions{display:block}#sfp-skins-actions .button{margin:7px 0;padding:0 10px 0 7px}#sfp-skins-actions .button .dashicons{vertical-align:middle;margin-bottom:2px}#sfp-skins-actions #sfp-skins-view{float:left}body #customize-controls #customize-notifications-area,body #customize-controls .wp-full-overlay-sidebar-content{top:90px}body[class*='sfps-logged-'] #sfps-connecting{display:none}#accordion-section-sfp_skins_section>.accordion-section-title{display:none}#sfps-app-wrap,#sfps-app{position:fixed;top:0;bottom:0;left:0;right:0;z-index:1000000;background:rgba(0,0,0,0.25);margin:auto}#sfps-app{z-index:0;background:#fff;width:calc( 100vw - 50px );height:calc( 100vh - 50px )}#sfps-app-wrap>i{display:block;float:right;font-size:35px;color:#fff;padding:3px;position:relative;z-index:7;cursor:pointer;height:auto;width:auto;text-shadow:-1px 1px 3px rgba(0,0,0,0.5)}#sfps-new-user,#sfps-user-actions{display:none}.sfps-logged-out #sfps-new-user,.sfps-logged-in #sfps-user-actions{display:block} +#customize-header-actions #sfp-skins-save-dialog{position:absolute;top:0;left:52px}#sfp-skins-overlay,#sfp-skins-notice,#sfp-skins-dialog{position:fixed;top:0;left:0;right:0;bottom:0;margin:auto;background:rgba(0,0,0,0.5);z-index:97}#sfp-skins-notice{height:52px;width:520px;text-align:center;background:none}#sfp-skins-notice-message{padding:1em 1.6em;display:inline-block;font:200 25px lato, sans-serif;background:#0085ba;color:#fff;border-radius:99px}#sfp-skins-dialog{background:none;width:90vw;max-width:520px;height:120px;background:#fff;padding:0 16px}#sfp-skins-dialog header{padding:16px 16px 11px;font:300 16px sans-serif;background:#ddd;text-transform:uppercase;margin:0 -16px 16px}#sfp-skins-dialog header .dashicons-no{float:right;margin:-16px;padding:13px;cursor:pointer}#sfp-skins-dialog>input,#sfp-skins-dialog>button{text-align:center;line-height:35px;padding:0;margin:0;box-sizing:border-box;height:auto;box-shadow:none;float:left;width:21%;border-radius:0 5px 5px 0}#sfp-skins-dialog input{padding:0 0.5em;text-align:left;width:79%;border-radius:5px 0 0 5px}#sfp-skins-dialog .notice.already-exists{width:100%;position:absolute;bottom:124%;padding:1em;box-sizing:border-box;left:0;margin:0;border-radius:5px}#sfp-skins-dialog .notice.already-exists *{margin:0}#sfp-skins-dialog .notice.already-exists button{float:right}.no-skins{font-size:1.1em;color:#777}h3.sfp-skin-button{padding:1em;background:#fff;border:1px solid #ccc;cursor:pointer;opacity:0.88;position:relative;overflow:hidden}h3.sfp-skin-button:hover{opacity:1}h3.sfp-skin-button .sync,h3.sfp-skin-button .delete{position:absolute;top:50%;margin-top:-10px;right:0.5em}h3.sfp-skin-button .sync{background:inherit;right:1.6em;margin-top:-15px;padding:5px 0;transition:opacity 0.35s;opacity:0}h3.sfp-skin-button:hover .sync{opacity:1}h3.sfp-skin-button ~ .no-skins{display:none}#sfp-skins-actions{position:absolute;top:45px;left:0;right:0;border-top:1px solid #ccc;border-bottom:1px solid #ccc;padding:0 1em;display:none}#customize-header-actions+#sfp-skins-actions{display:block}#sfp-skins-actions .button{margin:7px 0;padding:0 10px 0 7px}#sfp-skins-actions .button .dashicons{vertical-align:middle;margin-bottom:2px}#sfp-skins-actions #sfp-skins-view{float:left}body #customize-controls #customize-notifications-area,body #customize-controls .wp-full-overlay-sidebar-content{top:90px}body[class*='sfps-logged-'] #sfps-connecting{display:none}#accordion-section-sfp_skins_section>.accordion-section-title{display:none}#sfps-app-wrap,#sfps-app{position:fixed;top:0;bottom:0;left:0;right:0;z-index:1000000;background:rgba(0,0,0,0.25);margin:auto}#sfps-app{z-index:0;background:#fff;width:calc( 100vw - 50px );height:calc( 100vh - 50px )}#sfps-app-wrap>i{display:block;float:right;font-size:35px;color:#fff;padding:3px;position:relative;z-index:7;cursor:pointer;height:auto;width:auto;text-shadow:-1px 1px 3px rgba(0,0,0,0.5)}#sfps-new-user,#sfps-user-actions{display:none}.sfps-logged-out #sfps-new-user,.sfps-logged-in #sfps-user-actions{display:block} /*# sourceMappingURL=admin.css.map */ diff --git a/assets/admin.css.map b/assets/admin.css.map index c21ebaf..cabc3d3 100644 --- a/assets/admin.css.map +++ b/assets/admin.css.map @@ -1,6 +1,6 @@ { "version": 3, -"mappings": "AAMA,gDAAiD,CAChD,QAAQ,CAAE,QAAQ,CAClB,GAAG,CAAE,CAAC,CACN,IAAI,CAAE,IAAI,CAGX,+EAAkF,CACjF,QAAQ,CAAE,KAAK,CACf,GAAG,CAAE,CAAC,CACN,IAAI,CAAE,CAAC,CACP,KAAK,CAAE,CAAC,CACR,MAAM,CAAE,CAAC,CACT,MAAM,CAAE,IAAI,CACZ,UAAU,CAAE,eAAe,CAC3B,OAAO,CAAE,EAAE,CAEZ,wBAAyB,CACxB,MAAM,CAAE,IAAI,CACZ,KAAK,CAAE,KAAK,CACZ,OAAO,CAAE,GAAG,CACZ,UAAU,CAAE,IAAI,CAChB,MAAM,CAAE,eAAe,CACvB,0DAAU,CACT,MAAM,CAAE,GAAG,CACX,KAAK,CAAC,KAAK,CAIb,iBAAkB,CACjB,MAAM,CAAE,IAAI,CACZ,KAAK,CAAE,KAAK,CACZ,UAAU,CAAE,MAAM,CAClB,UAAU,CAAE,IAAI,CAGjB,yBAA0B,CACzB,OAAO,CAAE,SAAS,CAClB,OAAO,CAAE,YAAY,CACrB,IAAI,CAAE,yBAAyB,CAC/B,UAAU,CAAE,OAAO,CACnB,KAAK,CAAE,IAAI,CACX,aAAa,CAAE,IAAI,CAGpB,iBAAkB,CACjB,UAAU,CAAE,IAAI,CAChB,KAAK,CAAE,IAAI,CACX,SAAS,CAAE,KAAK,CAChB,MAAM,CAAE,KAAK,CACb,UAAU,CAAE,IAAI,CAChB,OAAO,CAAE,MAAM,CACf,wBAAO,CACN,OAAO,CAAE,cAAc,C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,GAAG,CAAE,IAAI,CACT,IAAI,CAAE,CAAC,CACP,KAAK,CAAE,CAAC,CACR,UAAU,CAAE,cAAc,CAC1B,aAAa,CAAE,cAAc,CAC7B,OAAO,CAAE,KAAK,CACd,OAAO,CAAE,IAAI,CACb,4CAA8B,CAC7B,OAAO,CAAE,KAAK,CAEf,0BAAQ,CACP,MAAM,CAAE,KAAK,CACb,OAAO,CAAE,YAAY,CACrB,qCAAW,CACV,cAAc,CAAE,MAAM,CACtB,aAAa,CAAE,GAAG,CAIpB,kCAAgB,CACf,KAAK,CAAE,IAAI,CAKZ,gHACiC,CAChC,GAAG,CAAE,IAAI,CAKV,4CAAiB,CAChB,OAAO,CAAE,IAAI,CAIf,6DAAgE,CAC/D,OAAO,CAAE,IAAI,CAed,wBAA0B,CACzB,QAAQ,CAAE,KAAK,CACf,GAAG,CAAE,CAAC,CACN,MAAM,CAAE,CAAC,CACT,IAAI,CAAE,CAAC,CACP,KAAK,CAAE,CAAC,CACR,OAAO,CAAE,OAAO,CAChB,UAAU,CAAE,gBAAgB,CAC5B,MAAM,CAAE,IAAI,CAGb,SAAU,CACT,OAAO,CAAE,CAAC,CACV,UAAU,CAAE,IAAI,CAChB,KAAK,CAAE,oBAAoB,CAC3B,MAAM,CAAE,oBAAoB,CAG7B,gBAAmB,CAClB,OAAO,CAAE,KAAK,CACd,KAAK,CAAE,KAAK,CACZ,SAAS,CAAE,IAAI,CACf,KAAK,CAAE,IAAI,CACX,OAAO,CAAE,GAAG,CACZ,QAAQ,CAAE,QAAQ,CAClB,OAAO,CAAE,CAAC,CACV,MAAM,CAAE,OAAO,CACf,MAAM,CAAE,IAAI,CACZ,KAAK,CAAE,IAAI,CACX,WAAW,CAAE,4BAA2B,CAGzC,iCACmB,CAClB,OAAO,CAAE,IAAI,CAGd,kEACmC,CAClC,OAAO,CAAE,KAAK", "sources": ["admin.scss"], "names": [], "file": "admin.css" diff --git a/assets/admin.js b/assets/admin.js index e34725c..338ad3a 100755 --- a/assets/admin.js +++ b/assets/admin.js @@ -73,10 +73,14 @@ jQuery( function ( $ ) { if ( ! message ) { return; } - $( '#sfp-skins-notice' ).html( '
' + message + '
' ).fadeIn( 250 ); + $( '#sfp-skins-notice' ) + .html( '
' + message + '
' ) + .fadeIn( 250 ); + setTimeout( function () { return $( '#sfp-skins-notice' ).html( '' ).fadeOut( 250 ); - }, 2000 ); + }, 2500 ); + }; sfpSkins.getSkinValues = function () { @@ -151,21 +155,6 @@ jQuery( function ( $ ) { sfpSkins.notice( 'Skin Saved' ); } ); - sfpSkins.$skinApplyConfirmDialog.find( '.button-primary' ).click( function () { - $.each( sfpSkins.$skinApplyConfirmDialog.data( 'settings' ), function ( setID, value ) { - var settingId; - settingId = 'string' === typeof sfpSkins.settingsMaps[setID] ? sfpSkins.settingsMaps[setID] : sfpSkins.settingsMaps[setID + ']']; - if ( settingId ) { - sfpSkins.set( settingId, value ); - } else { - console.log( 'Couldn\'t find setting for ' + setID ); - } - return void 0; - } ); - sfpSkins.$skinApplyConfirmDialog.hide(); - return sfpSkins.notice( 'Skin applied.' ); - } ); - sfpSkins.$orle.click( sfpSkins.closeSaveDlg ); sfpSkins.$wrap.click( function ( e ) { @@ -214,7 +203,17 @@ jQuery( function ( $ ) { applySkin: function ( skn ) { $appWrap.fadeOut(); if ( skn ) { - sfpSkins.$skinApplyConfirmDialog.data( 'skin', skn.name ).data( 'settings', skn.data ).show().find( '.skin-name' ).html( skn.name ); + $.each( skn.data, function ( setID, value ) { + var settingId; + settingId = 'string' === typeof sfpSkins.settingsMaps[setID] ? sfpSkins.settingsMaps[setID] : sfpSkins.settingsMaps[setID + ']']; + if ( settingId ) { + sfpSkins.set( settingId, value ); + } else { + console.log( 'Couldn\'t find setting for ' + setID ); + } + return void 0; + } ); + return sfpSkins.notice( 'Loading skin preview...' ); } } }, diff --git a/assets/admin.min.js b/assets/admin.min.js index 0f4dac3..4f739a6 100644 --- a/assets/admin.min.js +++ b/assets/admin.min.js @@ -1 +1 @@ -sfps={};sfpSkins="object"===typeof sfpSkins&&sfpSkins?sfpSkins:{};jQuery(function($){var $appWrap,$bd;sfpSkins.$orle=$("#sfp-skins-overlay");sfpSkins.$dlg=$("#sfp-skins-dialog");sfpSkins.$wrap=$("#sfp-skins-wrap");sfpSkins.$skinApplyConfirmDialog=$("#sfp-skins-apply-confirm");sfpSkins.settingsMaps={};sfpSkins.prepMaps=function(){var count,supportedTypes;sfpSkins.settingsMaps={};count=0;supportedTypes=["theme_mod"];$.each(wp.customize.settings.controls,function(k,control){var ref,setting,settingId;if(control&&control.settings&&control.settings["default"]){settingId=control.settings["default"];if(wp.customize.settings.settings[settingId]){setting=wp.customize.settings.settings[settingId];if(0>settingId.indexOf("sfp_skins")){if(supportedTypes.indexOf(setting.type)>=0){count++;sfpSkins.settingsMaps[settingId]=k}}}}return void 0});return console.log(count+" settings mapped")};sfpSkins.get=function(id){if(wp.customize.control.value(id)){return wp.customize.control.value(id).setting.get()}else{return"sfp_skins_no_value"}};sfpSkins.set=function(id,val){if(val==="false"){val=""}if(wp.customize.control.value(id)){return wp.customize.control.value(id).setting.set(val)}else{return console.log("Couldn't set "+id)}};sfpSkins.notice=function(message){if(!message){return}$("#sfp-skins-notice").html('
'+message+"
").fadeIn(250);setTimeout(function(){return $("#sfp-skins-notice").html("").fadeOut(250)},2e3)};sfpSkins.getSkinValues=function(){var values={};$.each(sfpSkins.settingsMaps,function(setID,conID){var val=sfpSkins.get(conID);if(val!=="sfp_skins_no_value"){if(val==="false"){val=""}if(typeof val==="string"){values[setID]=val}}});return values};sfpSkins.saveSkin=function(name,values){var skin;skin={name:name,data:values};return sfps.appMsg("saveSkin",skin)};sfpSkins.removeSkinsFromSite=function(msg){var data;sfpSkins.$wrap.html("");data={action:"sfp_clear_skins"};return $.post(ajaxurl,data,function(r){console.log("WPSkins AJAX Success:",r);if(msg){return sfpSkins.notice(msg)}}).fail(function(r){console.log("WPSkins AJAX Failed:",r);return sfpSkins.notice("Error: Could not connect to server")})};sfpSkins.prepMaps();sfpSkins.closeSaveDlg=function(){sfpSkins.$orle.hide();return sfpSkins.$dlg.hide()};$("#customize-header-actions").after($("#sfp-skins-actions"));$("#sfp-skins-save-dialog").click(function(){sfpSkins.$orle.show();return sfpSkins.$dlg.show()});$("#sfp-skins-save-skin").click(function(){var $sknName=$("#sfp-skins-skin-name");sfpSkins.saveSkin($sknName.val(),sfpSkins.getSkinValues());$sknName.val("");sfpSkins.closeSaveDlg();sfpSkins.notice("Skin Saved")});sfpSkins.$skinApplyConfirmDialog.find(".button-primary").click(function(){$.each(sfpSkins.$skinApplyConfirmDialog.data("settings"),function(setID,value){var settingId;settingId="string"===typeof sfpSkins.settingsMaps[setID]?sfpSkins.settingsMaps[setID]:sfpSkins.settingsMaps[setID+"]"];if(settingId){sfpSkins.set(settingId,value)}else{console.log("Couldn't find setting for "+setID)}return void 0});sfpSkins.$skinApplyConfirmDialog.hide();return sfpSkins.notice("Skin applied.")});sfpSkins.$orle.click(sfpSkins.closeSaveDlg);sfpSkins.$wrap.click(function(e){if(sfpSkins.timesClickedSkin===1){sfpSkins.doubleClickedSkin(e);sfpSkins.timesClickedSkin=2}else{sfpSkins.timesClickedSkin=1}return setTimeout(function(){if(sfpSkins.timesClickedSkin===1){sfpSkins.clickedSkin(e)}return sfpSkins.timesClickedSkin=false},250)});$bd=$("body");$appWrap=$("#sfps-app-wrap");sfps={postMsgActions:{loggedIn:function(){$bd.addClass("sfps-logged-in");$bd.removeClass("sfps-logged-out");if(sfpSkins.data&&!jQuery.isEmptyObject(sfpSkins.data)){sfps.appMsg("syncSkins",sfpSkins.data)}else{$appWrap.fadeOut()}},syncedSkins:function(success){if(success){delete sfpSkins.data;sfpSkins.removeSkinsFromSite("Skins synced to Pootle cloud successfully.")}$appWrap.fadeOut()},loggedOut:function(){$bd.removeClass("sfps-logged-in");$bd.addClass("sfps-logged-out");$appWrap.fadeOut()},applySkin:function(skn){$appWrap.fadeOut();if(skn){sfpSkins.$skinApplyConfirmDialog.data("skin",skn.name).data("settings",skn.data).show().find(".skin-name").html(skn.name)}}},saveRow:function(){if($bd.hasClass("sfps-logged-in")){$nameDlg.ppbDialog("open")}else{alert("You need to login to your pootle cloud account before you can save templates.")}},manage:function(){$appWrap.fadeIn()},logout:function(){sfps.appMsg("logout")},loginPopup:function(){sfps.showLogin=true;$appWrap.fadeIn()},appMsg:function(cb,payload){sfps.appWin.postMessage({sfpsCallback:cb,payload:payload},"*")},receiveMessage:function(e){var callback,msg,payload;callback=void 0;payload=void 0;msg=e[e.message?"message":"data"];if(e.origin.replace(/http[s]?:\/\//,"").indexOf(sfpSkins.appUrl)&&msg.sfpsCallback){callback=msg.sfpsCallback;payload=msg.payload;console.log(callback);if(typeof sfps.postMsgActions[callback]==="function"){sfps.postMsgActions[callback](payload);sfps.appWin=e.source}}}};window.addEventListener("message",sfps.receiveMessage,false);console.log(sfpSkins.appUrl);$appWrap.find("iframe").attr("src",sfpSkins.appUrl)}); \ No newline at end of file +sfps={};sfpSkins="object"===typeof sfpSkins&&sfpSkins?sfpSkins:{};jQuery(function($){var $appWrap,$bd;sfpSkins.$orle=$("#sfp-skins-overlay");sfpSkins.$dlg=$("#sfp-skins-dialog");sfpSkins.$wrap=$("#sfp-skins-wrap");sfpSkins.$skinApplyConfirmDialog=$("#sfp-skins-apply-confirm");sfpSkins.settingsMaps={};sfpSkins.prepMaps=function(){var count,supportedTypes;sfpSkins.settingsMaps={};count=0;supportedTypes=["theme_mod"];$.each(wp.customize.settings.controls,function(k,control){var ref,setting,settingId;if(control&&control.settings&&control.settings["default"]){settingId=control.settings["default"];if(wp.customize.settings.settings[settingId]){setting=wp.customize.settings.settings[settingId];if(0>settingId.indexOf("sfp_skins")){if(supportedTypes.indexOf(setting.type)>=0){count++;sfpSkins.settingsMaps[settingId]=k}}}}return void 0});return console.log(count+" settings mapped")};sfpSkins.get=function(id){if(wp.customize.control.value(id)){return wp.customize.control.value(id).setting.get()}else{return"sfp_skins_no_value"}};sfpSkins.set=function(id,val){if(val==="false"){val=""}if(wp.customize.control.value(id)){return wp.customize.control.value(id).setting.set(val)}else{return console.log("Couldn't set "+id)}};sfpSkins.notice=function(message){if(!message){return}$("#sfp-skins-notice").html('
'+message+"
").fadeIn(250);setTimeout(function(){return $("#sfp-skins-notice").html("").fadeOut(250)},2500)};sfpSkins.getSkinValues=function(){var values={};$.each(sfpSkins.settingsMaps,function(setID,conID){var val=sfpSkins.get(conID);if(val!=="sfp_skins_no_value"){if(val==="false"){val=""}if(typeof val==="string"){values[setID]=val}}});return values};sfpSkins.saveSkin=function(name,values){var skin;skin={name:name,data:values};return sfps.appMsg("saveSkin",skin)};sfpSkins.removeSkinsFromSite=function(msg){var data;sfpSkins.$wrap.html("");data={action:"sfp_clear_skins"};return $.post(ajaxurl,data,function(r){console.log("WPSkins AJAX Success:",r);if(msg){return sfpSkins.notice(msg)}}).fail(function(r){console.log("WPSkins AJAX Failed:",r);return sfpSkins.notice("Error: Could not connect to server")})};sfpSkins.prepMaps();sfpSkins.closeSaveDlg=function(){sfpSkins.$orle.hide();return sfpSkins.$dlg.hide()};$("#customize-header-actions").after($("#sfp-skins-actions"));$("#sfp-skins-save-dialog").click(function(){sfpSkins.$orle.show();return sfpSkins.$dlg.show()});$("#sfp-skins-save-skin").click(function(){var $sknName=$("#sfp-skins-skin-name");sfpSkins.saveSkin($sknName.val(),sfpSkins.getSkinValues());$sknName.val("");sfpSkins.closeSaveDlg();sfpSkins.notice("Skin Saved")});sfpSkins.$orle.click(sfpSkins.closeSaveDlg);sfpSkins.$wrap.click(function(e){if(sfpSkins.timesClickedSkin===1){sfpSkins.doubleClickedSkin(e);sfpSkins.timesClickedSkin=2}else{sfpSkins.timesClickedSkin=1}return setTimeout(function(){if(sfpSkins.timesClickedSkin===1){sfpSkins.clickedSkin(e)}return sfpSkins.timesClickedSkin=false},250)});$bd=$("body");$appWrap=$("#sfps-app-wrap");sfps={postMsgActions:{loggedIn:function(){$bd.addClass("sfps-logged-in");$bd.removeClass("sfps-logged-out");if(sfpSkins.data&&!jQuery.isEmptyObject(sfpSkins.data)){sfps.appMsg("syncSkins",sfpSkins.data)}else{$appWrap.fadeOut()}},syncedSkins:function(success){if(success){delete sfpSkins.data;sfpSkins.removeSkinsFromSite("Skins synced to Pootle cloud successfully.")}$appWrap.fadeOut()},loggedOut:function(){$bd.removeClass("sfps-logged-in");$bd.addClass("sfps-logged-out");$appWrap.fadeOut()},applySkin:function(skn){$appWrap.fadeOut();if(skn){$.each(skn.data,function(setID,value){var settingId;settingId="string"===typeof sfpSkins.settingsMaps[setID]?sfpSkins.settingsMaps[setID]:sfpSkins.settingsMaps[setID+"]"];if(settingId){sfpSkins.set(settingId,value)}else{console.log("Couldn't find setting for "+setID)}return void 0});return sfpSkins.notice("Loading skin preview...")}}},saveRow:function(){if($bd.hasClass("sfps-logged-in")){$nameDlg.ppbDialog("open")}else{alert("You need to login to your pootle cloud account before you can save templates.")}},manage:function(){$appWrap.fadeIn()},logout:function(){sfps.appMsg("logout")},loginPopup:function(){sfps.showLogin=true;$appWrap.fadeIn()},appMsg:function(cb,payload){sfps.appWin.postMessage({sfpsCallback:cb,payload:payload},"*")},receiveMessage:function(e){var callback,msg,payload;callback=void 0;payload=void 0;msg=e[e.message?"message":"data"];if(e.origin.replace(/http[s]?:\/\//,"").indexOf(sfpSkins.appUrl)&&msg.sfpsCallback){callback=msg.sfpsCallback;payload=msg.payload;console.log(callback);if(typeof sfps.postMsgActions[callback]==="function"){sfps.postMsgActions[callback](payload);sfps.appWin=e.source}}}};window.addEventListener("message",sfps.receiveMessage,false);console.log(sfpSkins.appUrl);$appWrap.find("iframe").attr("src",sfpSkins.appUrl)}); \ No newline at end of file diff --git a/assets/admin.scss b/assets/admin.scss index 0240daa..4736f27 100755 --- a/assets/admin.scss +++ b/assets/admin.scss @@ -10,7 +10,7 @@ left: 52px; } -#sfp-skins-apply-confirm,#sfp-skins-overlay, #sfp-skins-notice, #sfp-skins-dialog { +#sfp-skins-overlay, #sfp-skins-notice, #sfp-skins-dialog { position: fixed; top: 0; left: 0; @@ -20,17 +20,6 @@ background: rgba(0,0,0,0.5); z-index: 97; } -#sfp-skins-apply-confirm { - height: 70px; - width: 520px; - padding: 1em; - background: #fff; - border: 1px outset #aaa; - button, p { - margin: 1em; - float:right; - } -} #sfp-skins-notice { height: 52px;