diff options
author | Kamil Kaminski <kylek389@gmail.com> | 2014-12-15 20:14:14 -0600 |
---|---|---|
committer | Kamil Kaminski <kylek389@gmail.com> | 2014-12-15 21:53:16 -0600 |
commit | 298c2990e6b039b9d8e7cf746fe70b6982b8182a (patch) | |
tree | 93c58110b995a7484ec0f0d6696a7266d11247d4 /js | |
parent | f0de7af14312368a11014befa428ff91bbebff76 (diff) | |
download | fracturedcms-master.tar.gz fracturedcms-master.tar.bz2 fracturedcms-master.zip |
Diffstat (limited to 'js')
-rw-r--r-- | js/editinplace.php | 88 | ||||
-rw-r--r-- | js/rte.php | 4 |
2 files changed, 46 insertions, 46 deletions
diff --git a/js/editinplace.php b/js/editinplace.php index 612617a..0765d50 100644 --- a/js/editinplace.php +++ b/js/editinplace.php @@ -1,44 +1,44 @@ -/*!
-Autosize v1.18.1 - 2013-11-05
-Automatically adjust textarea height based on user input.
-(c) 2013 Jack Moore - http://www.jacklmoore.com/autosize
-license: http://www.opensource.org/licenses/mit-license.php
-*/
-(function(e){var t,o={className:"autosizejs",append:"",callback:!1,resizeDelay:10},i='<textarea tabindex="-1" style="position:absolute; top:-999px; left:0; right:auto; bottom:auto; border:0; padding: 0; -moz-box-sizing:content-box; -webkit-box-sizing:content-box; box-sizing:content-box; word-wrap:break-word; height:0 !important; min-height:0 !important; overflow:hidden; transition:none; -webkit-transition:none; -moz-transition:none;"/>',n=["fontFamily","fontSize","fontWeight","fontStyle","letterSpacing","textTransform","wordSpacing","textIndent"],s=e(i).data("autosize",!0)[0];s.style.lineHeight="99px","99px"===e(s).css("lineHeight")&&n.push("lineHeight"),s.style.lineHeight="",e.fn.autosize=function(i){return this.length?(i=e.extend({},o,i||{}),s.parentNode!==document.body&&e(document.body).append(s),this.each(function(){function o(){var t,o;"getComputedStyle"in window?(t=window.getComputedStyle(u,null),o=u.getBoundingClientRect().width,e.each(["paddingLeft","paddingRight","borderLeftWidth","borderRightWidth"],function(e,i){o-=parseInt(t[i],10)}),s.style.width=o+"px"):s.style.width=Math.max(p.width(),0)+"px"}function a(){var a={};if(t=u,s.className=i.className,d=parseInt(p.css("maxHeight"),10),e.each(n,function(e,t){a[t]=p.css(t)}),e(s).css(a),o(),window.chrome){var r=u.style.width;u.style.width="0px",u.offsetWidth,u.style.width=r}}function r(){var e,n;t!==u?a():o(),s.value=u.value+i.append,s.style.overflowY=u.style.overflowY,n=parseInt(u.style.height,10),s.scrollTop=0,s.scrollTop=9e4,e=s.scrollTop,d&&e>d?(u.style.overflowY="scroll",e=d):(u.style.overflowY="hidden",c>e&&(e=c)),e+=w,n!==e&&(u.style.height=e+"px",f&&i.callback.call(u,u))}function l(){clearTimeout(h),h=setTimeout(function(){var e=p.width();e!==g&&(g=e,r())},parseInt(i.resizeDelay,10))}var d,c,h,u=this,p=e(u),w=0,f=e.isFunction(i.callback),z={height:u.style.height,overflow:u.style.overflow,overflowY:u.style.overflowY,wordWrap:u.style.wordWrap,resize:u.style.resize},g=p.width();p.data("autosize")||(p.data("autosize",!0),("border-box"===p.css("box-sizing")||"border-box"===p.css("-moz-box-sizing")||"border-box"===p.css("-webkit-box-sizing"))&&(w=p.outerHeight()-p.height()),c=Math.max(parseInt(p.css("minHeight"),10)-w||0,p.height()),p.css({overflow:"hidden",overflowY:"hidden",wordWrap:"break-word",resize:"none"===p.css("resize")||"vertical"===p.css("resize")?"none":"horizontal"}),"onpropertychange"in u?"oninput"in u?p.on("input.autosize keyup.autosize",r):p.on("propertychange.autosize",function(){"value"===event.propertyName&&r()}):p.on("input.autosize",r),i.resizeDelay!==!1&&e(window).on("resize.autosize",l),p.on("autosize.resize",r),p.on("autosize.resizeIncludeStyle",function(){t=null,r()}),p.on("autosize.destroy",function(){t=null,clearTimeout(h),e(window).off("resize",l),p.off("autosize").off(".autosize").css(z).removeData("autosize")}),r())})):this}})(window.$||window.$);
-var changing = false;
-
-$(document).ready(function($){
- $('span.editText').click(function(){
- if(changing)return;
- a = $(this);
- title=(a.attr('title'))?title="\""+a.attr('title')+"\" ":"";
-
- if(a.hasClass('richText')){
- <?php if(isset($_REQUEST['hook']))
- include($_REQUEST['hook']);
- ?>
- }
- else{
- a.html("<textarea "+title+"name=\"textarea\" id=\""+ a.attr('id') +"_field\" onblur=\"fieldSave(a.attr('id'),nl2br(this.value));\">" + a.html().replace(/<br>/gi, "") + "</textarea>");
- a.children(':first').focus().autosize().trigger('autosize.resize');
- }
- changing = true;
- });
-
- $('.toggle').click(function(){
- $('.hide').toggle('200');
- });
-});
-
-function nl2br(s){
- return (s + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1<br />$2');
-}
-
-function fieldSave(key,val){
- $.post('edittext.php', {fieldname: key, content: val}).done(function(data){
- if(key == 'theme_name'){location.reload(true);}
- else if(val==''){$('#'+key).html($('#'+key).attr('title'));}
- else {$("#"+key).html(data);}
- changing = false;
- });
-}
\ No newline at end of file +/*! +Autosize v1.18.1 - 2013-11-05 +Automatically adjust textarea height based on user input. +(c) 2013 Jack Moore - http://www.jacklmoore.com/autosize +license: http://www.opensource.org/licenses/mit-license.php +*/ +(function(e){var t,o={className:"autosizejs",append:"",callback:!1,resizeDelay:10},i='<textarea tabindex="-1" style="position:absolute; top:-999px; left:0; right:auto; bottom:auto; border:0; padding: 0; -moz-box-sizing:content-box; -webkit-box-sizing:content-box; box-sizing:content-box; word-wrap:break-word; height:0 !important; min-height:0 !important; overflow:hidden; transition:none; -webkit-transition:none; -moz-transition:none;"/>',n=["fontFamily","fontSize","fontWeight","fontStyle","letterSpacing","textTransform","wordSpacing","textIndent"],s=e(i).data("autosize",!0)[0];s.style.lineHeight="99px","99px"===e(s).css("lineHeight")&&n.push("lineHeight"),s.style.lineHeight="",e.fn.autosize=function(i){return this.length?(i=e.extend({},o,i||{}),s.parentNode!==document.body&&e(document.body).append(s),this.each(function(){function o(){var t,o;"getComputedStyle"in window?(t=window.getComputedStyle(u,null),o=u.getBoundingClientRect().width,e.each(["paddingLeft","paddingRight","borderLeftWidth","borderRightWidth"],function(e,i){o-=parseInt(t[i],10)}),s.style.width=o+"px"):s.style.width=Math.max(p.width(),0)+"px"}function a(){var a={};if(t=u,s.className=i.className,d=parseInt(p.css("maxHeight"),10),e.each(n,function(e,t){a[t]=p.css(t)}),e(s).css(a),o(),window.chrome){var r=u.style.width;u.style.width="0px",u.offsetWidth,u.style.width=r}}function r(){var e,n;t!==u?a():o(),s.value=u.value+i.append,s.style.overflowY=u.style.overflowY,n=parseInt(u.style.height,10),s.scrollTop=0,s.scrollTop=9e4,e=s.scrollTop,d&&e>d?(u.style.overflowY="scroll",e=d):(u.style.overflowY="hidden",c>e&&(e=c)),e+=w,n!==e&&(u.style.height=e+"px",f&&i.callback.call(u,u))}function l(){clearTimeout(h),h=setTimeout(function(){var e=p.width();e!==g&&(g=e,r())},parseInt(i.resizeDelay,10))}var d,c,h,u=this,p=e(u),w=0,f=e.isFunction(i.callback),z={height:u.style.height,overflow:u.style.overflow,overflowY:u.style.overflowY,wordWrap:u.style.wordWrap,resize:u.style.resize},g=p.width();p.data("autosize")||(p.data("autosize",!0),("border-box"===p.css("box-sizing")||"border-box"===p.css("-moz-box-sizing")||"border-box"===p.css("-webkit-box-sizing"))&&(w=p.outerHeight()-p.height()),c=Math.max(parseInt(p.css("minHeight"),10)-w||0,p.height()),p.css({overflow:"hidden",overflowY:"hidden",wordWrap:"break-word",resize:"none"===p.css("resize")||"vertical"===p.css("resize")?"none":"horizontal"}),"onpropertychange"in u?"oninput"in u?p.on("input.autosize keyup.autosize",r):p.on("propertychange.autosize",function(){"value"===event.propertyName&&r()}):p.on("input.autosize",r),i.resizeDelay!==!1&&e(window).on("resize.autosize",l),p.on("autosize.resize",r),p.on("autosize.resizeIncludeStyle",function(){t=null,r()}),p.on("autosize.destroy",function(){t=null,clearTimeout(h),e(window).off("resize",l),p.off("autosize").off(".autosize").css(z).removeData("autosize")}),r())})):this}})(window.$||window.$); +var changing = false; + +$(document).ready(function($){ + $('span.editText').click(function(){ + if(changing)return; + a = $(this); + title=(a.attr('title'))?title="\""+a.attr('title')+"\" ":""; + + if(a.hasClass('richText')){ + <?php if(isset($_REQUEST['hook'])) + include($_REQUEST['hook']); + ?> + } + else{ + a.html("<textarea "+title+"name=\"textarea\" id=\""+ a.attr('id') +"_field\" onblur=\"fieldSave(a.attr('id'),nl2br(this.value));\">" + a.html().replace(/<br>/gi, "") + "</textarea>"); + a.children(':first').focus().autosize().trigger('autosize.resize'); + } + changing = true; + }); + + $('.toggle').click(function(){ + $('.hide').toggle('200'); + }); +}); + +function nl2br(s){ + return (s + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1<br />$2'); +} + +function fieldSave(key,val){ + $.post('edittext.php', {fieldname: key, content: val}).done(function(data){ + if(key == 'theme_name'){location.reload(true);} + else if(val==''){$('#'+key).html($('#'+key).attr('title'));} + else {$("#"+key).html(data);} + changing = false; + }); +} @@ -1,2 +1,2 @@ -a.html("<textarea "+title+"name=\"textarea\" id=\""+ a.attr('id') +"_field\" onblur=\"fieldSave(a.attr('id'),nl2br(this.value));\">" + a.html().replace(/<br>/gi, "") + "</textarea>");
-a.children(':first').focus().autosize().trigger('autosize.resize');
\ No newline at end of file +a.html("<textarea "+title+"name=\"textarea\" id=\""+ a.attr('id') +"_field\" onblur=\"fieldSave(a.attr('id'),nl2br(this.value));\">" + a.html().replace(/<br>/gi, "") + "</textarea>"); +a.children(':first').focus().autosize().trigger('autosize.resize'); |