| 1 |
/* |
| 2 |
|
| 3 |
Using Jquery for post snippet save button design |
| 4 |
|
| 5 |
*/ |
| 6 |
|
| 7 |
jQuery(document).ready(function($){ |
| 8 |
|
| 9 |
// editor code of css and js save button design |
| 10 |
if ($('#ps_option_meta_box').length) { |
| 11 |
$(".save-button-area").css({"display":"block", |
| 12 |
"margin-top":"-22px", |
| 13 |
}); |
| 14 |
} |
| 15 |
// editor code save button functionality |
| 16 |
if( $('#pspro_snippet_shortcode').is(':checked') && $('.notice-error').length==0) { |
| 17 |
$('.save-button-area').css({'margin-top':'-2px'}); |
| 18 |
} |
| 19 |
// change margin of save button on checkbox click |
| 20 |
$('#pspro_snippet_shortcode').on('click', function(){ |
| 21 |
if( $(this).is(':checked') && $("#pspro_edit_shotcode_text").length!=0) { |
| 22 |
$(".save-button-area").css({"margin-top":"-2px"}); |
| 23 |
} |
| 24 |
else if($(this).is(':checked')==false) { |
| 25 |
$(".save-button-area").css({"margin-top":"-48px"}); |
| 26 |
} |
| 27 |
}) |
| 28 |
|
| 29 |
}); |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
var post_snippets_editor_atts = { |
| 35 |
mode: "php-snippet", |
| 36 |
matchBrackets: true, |
| 37 |
extraKeys: { "Alt-F": "findPersistent" }, |
| 38 |
gutters: ["CodeMirror-lint-markers"], |
| 39 |
lint: true, |
| 40 |
direction: "ltr", |
| 41 |
viewportMargin: 10, |
| 42 |
scrollbarStyle: 'native', |
| 43 |
theme: "default", |
| 44 |
indentWithTabs: true, |
| 45 |
tabSize: 4, |
| 46 |
indentUnit: 4, |
| 47 |
lineWrapping: true, |
| 48 |
lineNumbers: true, |
| 49 |
autoCloseBrackets: true, |
| 50 |
highlightSelectionMatches: true, |
| 51 |
}; |
| 52 |
|
| 53 |
!(function e(t, r, n) { |
| 54 |
function o(c, d) { |
| 55 |
if (!r[c]) { |
| 56 |
if (!t[c]) { |
| 57 |
var a = "function" == typeof require && require; |
| 58 |
if (!d && a) return a(c, !0); |
| 59 |
if (i) return i(c, !0); |
| 60 |
var u = new Error("Cannot find module '" + c + "'"); |
| 61 |
throw ((u.code = "MODULE_NOT_FOUND"), u); |
| 62 |
} |
| 63 |
var p = (r[c] = { exports: {} }); |
| 64 |
t[c][0].call( |
| 65 |
p.exports, |
| 66 |
function (e) { |
| 67 |
return o(t[c][1][e] || e); |
| 68 |
}, |
| 69 |
p, |
| 70 |
p.exports, |
| 71 |
e, |
| 72 |
t, |
| 73 |
r, |
| 74 |
n |
| 75 |
); |
| 76 |
} |
| 77 |
return r[c].exports; |
| 78 |
} |
| 79 |
for ( |
| 80 |
var i = "function" == typeof require && require, c = 0; |
| 81 |
c < n.length; |
| 82 |
c++ |
| 83 |
) |
| 84 |
o(n[c]); |
| 85 |
return o; |
| 86 |
})( |
| 87 |
{ |
| 88 |
1: [ |
| 89 |
function (e, t, r) { |
| 90 |
"use strict"; |
| 91 |
var n, o, i, c; |
| 92 |
(window.post_snippets_editor = |
| 93 |
((n = window.Code_Snippets_CodeMirror), |
| 94 |
(o = post_snippets_editor_atts), |
| 95 |
// (i = function (e) { |
| 96 |
// return document.getElementById("save_snippet").click(); |
| 97 |
// }), |
| 98 |
// (o.extraKeys = window.navigator.platform.match("Mac") |
| 99 |
// ? { "Cmd-Enter": i, "Cmd-S": i } |
| 100 |
// : { "Ctrl-Enter": i, "Ctrl-S": i }), |
| 101 |
// window.navigator.platform.match("Mac") && |
| 102 |
// (document.querySelector(".editor-help-text").className += |
| 103 |
// " platform-mac"), |
| 104 |
n.fromTextArea(document.getElementById("ps_code_editor"), o)))//, |
| 105 |
// (c = document.getElementById("snippet-code-direction")) && |
| 106 |
// c.addEventListener("change", function () { |
| 107 |
// window.post_snippets_editor.setOption( |
| 108 |
// "direction", |
| 109 |
// "rtl" === c.value ? "rtl" : "ltr" |
| 110 |
// ); |
| 111 |
// }); |
| 112 |
}, |
| 113 |
{}, |
| 114 |
], |
| 115 |
}, |
| 116 |
{}, |
| 117 |
[1] |
| 118 |
); |
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|