diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-08-03 13:21:11 +0200 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-08-03 13:21:11 +0200 |
commit | c766284d522206578e7ec154961e0fce456f70c8 (patch) | |
tree | a5246151bf8278a0e8053b9dd1ce9d770073c50b /docs/js/editor.js | |
parent | c0cb52c07439c974075c302a190a034a8cce4f92 (diff) | |
parent | e968ec6c2244aee600358b3c87648b2409c97945 (diff) | |
download | wallabag-c766284d522206578e7ec154961e0fce456f70c8.tar.gz wallabag-c766284d522206578e7ec154961e0fce456f70c8.tar.zst wallabag-c766284d522206578e7ec154961e0fce456f70c8.zip |
Merge pull request #1267 from wallabag/dev1.9.1
1.9.1
Diffstat (limited to 'docs/js/editor.js')
-rw-r--r-- | docs/js/editor.js | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/docs/js/editor.js b/docs/js/editor.js deleted file mode 100644 index 9209d59c..00000000 --- a/docs/js/editor.js +++ /dev/null | |||
@@ -1,53 +0,0 @@ | |||
1 | $(document).ready(function() { | ||
2 | var markdown_editor = $("#markdown_editor"), | ||
3 | save_editor = $(".save_editor"), | ||
4 | editor = $(".editor"); | ||
5 | |||
6 | $("#editThis").click(function() { | ||
7 | editor.css({"display":"block"}); | ||
8 | markdown_editor.autosize().val(); | ||
9 | }); | ||
10 | |||
11 | $(".closeEditor").click(function() { | ||
12 | editor.css({"display":"none"}); | ||
13 | }); | ||
14 | |||
15 | save_editor.click(function() { | ||
16 | var original_text = save_editor.text(); | ||
17 | save_editor.text("Saving...").addClass("disabled"); | ||
18 | |||
19 | $.post(window.location.href, {markdown: markdown_editor.val(), method: 'DauxEdit' }, function() { | ||
20 | save_editor.text("Done! Reloading page in 5 seconds. You can cancel it with ESC key"); | ||
21 | |||
22 | var timeout = setTimeout(function() { | ||
23 | location.reload() | ||
24 | }, 5000); // lie | ||
25 | |||
26 | $(document).keyup(function(e) { | ||
27 | if (e.keyCode == 27) { // esc key | ||
28 | clearTimeout(timeout); | ||
29 | save_editor.text("Page reload cancelled"); | ||
30 | setTimeout(function() { | ||
31 | save_editor.text(original_text).removeClass('disabled'); | ||
32 | }, 2000); | ||
33 | } | ||
34 | }); | ||
35 | }).fail(function() { | ||
36 | save_editor.removeClass('disabled').addClass("btn-danger").text("Failed :( - try checking your read/write permissions"); | ||
37 | setTimeout(function() { | ||
38 | save_editor.text(original_text).removeClass('btn-danger'); | ||
39 | },5000); | ||
40 | }); | ||
41 | }); | ||
42 | }); | ||
43 | |||
44 | |||
45 | |||
46 | |||
47 | /*! | ||
48 | Autosize v1.18.4 - 2014-01-11 | ||
49 | Automatically adjust textarea height based on user input. | ||
50 | (c) 2014 Jack Moore - http://www.jacklmoore.com/autosize | ||
51 | license: http://www.opensource.org/licenses/mit-license.php | ||
52 | */ | ||
53 | !function(a){var b,c={className:"autosizejs",append:"",callback:!1,resizeDelay:10,placeholder:!0},d='<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;"/>',e=["fontFamily","fontSize","fontWeight","fontStyle","letterSpacing","textTransform","wordSpacing","textIndent"],f=a(d).data("autosize",!0)[0];f.style.lineHeight="99px","99px"===a(f).css("lineHeight")&&e.push("lineHeight"),f.style.lineHeight="",a.fn.autosize=function(d){return this.length?(d=a.extend({},c,d||{}),f.parentNode!==document.body&&a(document.body).append(f),this.each(function(){function c(){var b,c=window.getComputedStyle?window.getComputedStyle(m,null):!1;c?(b=m.getBoundingClientRect().width,0===b&&(b=parseInt(c.width,10)),a.each(["paddingLeft","paddingRight","borderLeftWidth","borderRightWidth"],function(a,d){b-=parseInt(c[d],10)})):b=Math.max(n.width(),0),f.style.width=b+"px"}function g(){var g={};if(b=m,f.className=d.className,j=parseInt(n.css("maxHeight"),10),a.each(e,function(a,b){g[b]=n.css(b)}),a(f).css(g),c(),window.chrome){var h=m.style.width;m.style.width="0px";{m.offsetWidth}m.style.width=h}}function h(){var e,h;b!==m?g():c(),f.value=!m.value&&d.placeholder?(a(m).attr("placeholder")||"")+d.append:m.value+d.append,f.style.overflowY=m.style.overflowY,h=parseInt(m.style.height,10),f.scrollTop=0,f.scrollTop=9e4,e=f.scrollTop,j&&e>j?(m.style.overflowY="scroll",e=j):(m.style.overflowY="hidden",k>e&&(e=k)),e+=o,h!==e&&(m.style.height=e+"px",p&&d.callback.call(m,m))}function i(){clearTimeout(l),l=setTimeout(function(){var a=n.width();a!==r&&(r=a,h())},parseInt(d.resizeDelay,10))}var j,k,l,m=this,n=a(m),o=0,p=a.isFunction(d.callback),q={height:m.style.height,overflow:m.style.overflow,overflowY:m.style.overflowY,wordWrap:m.style.wordWrap,resize:m.style.resize},r=n.width();n.data("autosize")||(n.data("autosize",!0),("border-box"===n.css("box-sizing")||"border-box"===n.css("-moz-box-sizing")||"border-box"===n.css("-webkit-box-sizing"))&&(o=n.outerHeight()-n.height()),k=Math.max(parseInt(n.css("minHeight"),10)-o||0,n.height()),n.css({overflow:"hidden",overflowY:"hidden",wordWrap:"break-word",resize:"none"===n.css("resize")||"vertical"===n.css("resize")?"none":"horizontal"}),"onpropertychange"in m?"oninput"in m?n.on("input.autosize keyup.autosize",h):n.on("propertychange.autosize",function(){"value"===event.propertyName&&h()}):n.on("input.autosize",h),d.resizeDelay!==!1&&a(window).on("resize.autosize",i),n.on("autosize.resize",h),n.on("autosize.resizeIncludeStyle",function(){b=null,h()}),n.on("autosize.destroy",function(){b=null,clearTimeout(l),a(window).off("resize",i),n.off("autosize").off(".autosize").css(q).removeData("autosize")}),h())})):this}}(window.jQuery||window.$); | ||