From 5ffece7923295f048f9f3c07bec932ae8a65705a Mon Sep 17 00:00:00 2001 From: Stephen Standridge Date: Wed, 3 Feb 2016 15:43:53 -0800 Subject: [PATCH] Add site_root to AJAX urls - Fixes an issue where serving Statamic from a subdirectory breaks this plugin, because the AJAX urls were hardcoded --- _add-ons/fileclerk/ft.fileclerk.php | 1 + _add-ons/fileclerk/js/build/fileclerk.min.js | 2 +- _add-ons/fileclerk/js/fileclerk.js | 10 +++++----- _add-ons/fileclerk/views/ft.fileclerk.html | 4 ++++ 4 files changed, 11 insertions(+), 6 deletions(-) mode change 100755 => 100644 _add-ons/fileclerk/js/build/fileclerk.min.js diff --git a/_add-ons/fileclerk/ft.fileclerk.php b/_add-ons/fileclerk/ft.fileclerk.php index 36d69ec..6e92df6 100644 --- a/_add-ons/fileclerk/ft.fileclerk.php +++ b/_add-ons/fileclerk/ft.fileclerk.php @@ -54,6 +54,7 @@ function render() 'is_image' => null, 'mime_type' => null, 'name' => $this->fieldname, + 'site_root' => "'" . Config::getSiteRoot() . "'", 'size' => null, 'size_bytes' => null, 'size_kilobytes' => null, diff --git a/_add-ons/fileclerk/js/build/fileclerk.min.js b/_add-ons/fileclerk/js/build/fileclerk.min.js old mode 100755 new mode 100644 index d56107a..159f80e --- a/_add-ons/fileclerk/js/build/fileclerk.min.js +++ b/_add-ons/fileclerk/js/build/fileclerk.min.js @@ -1 +1 @@ -!function(){for(var e,i=function(){},t=["assert","clear","count","debug","dir","dirxml","error","exception","group","groupCollapsed","groupEnd","info","log","markTimeline","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"],n=t.length,s=window.console=window.console||{};n--;)e=t[n],s[e]||(s[e]=i)}(),function(e,i){"object"==typeof exports?module.exports=i():"function"==typeof define&&define.amd?define(i):e.Spinner=i()}(this,function(){"use strict";function e(e,i){var t,n=document.createElement(e||"div");for(t in i)n[t]=i[t];return n}function i(e){for(var i=1,t=arguments.length;t>i;i++)e.appendChild(arguments[i]);return e}function t(e,i,t,n){var s=["opacity",i,~~(100*e),t,n].join("-"),l=.01+t/n*100,a=Math.max(1-(1-e)/i*(100-l),e),o=d.substring(0,d.indexOf("Animation")).toLowerCase(),r=o&&"-"+o+"-"||"";return f[s]||(u.insertRule("@"+r+"keyframes "+s+"{0%{opacity:"+a+"}"+l+"%{opacity:"+e+"}"+(l+.01)+"%{opacity:1}"+(l+i)%100+"%{opacity:"+e+"}100%{opacity:"+a+"}}",u.cssRules.length),f[s]=1),s}function n(e,i){var t,n,s=e.style;for(i=i.charAt(0).toUpperCase()+i.slice(1),n=0;n',t)}u.addRule(".spin-vml","behavior:url(#default#VML)"),o.prototype.lines=function(e,n){function l(){return s(t("group",{coordsize:c+" "+c,coordorigin:-d+" "+-d}),{width:c,height:c})}function o(e,o,r){i(u,i(s(l(),{rotation:360/n.lines*e+"deg",left:~~o}),i(s(t("roundrect",{arcsize:n.corners}),{width:d,height:n.width,left:n.radius,top:-n.width>>1,filter:r}),t("fill",{color:a(n.color,e),opacity:n.opacity}),t("stroke",{opacity:0}))))}var r,d=n.length+n.width,c=2*d,f=2*-(n.width+n.length)+"px",u=s(l(),{position:"absolute",top:f,left:f});if(n.shadow)for(r=1;r<=n.lines;r++)o(r,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(r=1;r<=n.lines;r++)o(r);return i(e,u)},o.prototype.opacity=function(e,i,t,n){var s=e.firstChild;n=n.shadow&&n.lines||0,s&&i+n>1)+"px"})}for(var r,c=0,f=(l.lines-1)*(1-l.direction)/2;c$.motionThreshold||x.ady>$.motionThreshold){for(clearTimeout(f),x.orientation||(x.adx>x.ady?(x.orientation="horizontal",x.direction=x.dx>0?1:-1):(x.orientation="vertical",x.direction=x.dy>0?1:-1));i.target&&i.target!==k.target;)i.target=i.target.parentNode;return i.target!==k.target?(i.target=k.target,void o.call(this,e.Event(b+"."+y,i))):void s(i,"drag")}}function o(e){var i,t=e.timeStamp||+new Date,n=t-k.time;if(clearTimeout(f),r||d||e.target!==k.target)e.target=k.target,n<$.flickDuration&&s(e,"flick"),x.end=!0,i="drag";else{var l=u===e.target&&t-p<$.doubleTapInterval;i=l?"doubletap":"tap",u=l?null:k.target,p=t}s(e,i,!0)}var r,d,c,f,u,p,h=/chrome/i.exec(i),v=/android/i.exec(i),g="ontouchstart"in window&&!(h&&!v),m=g?"touchstart":"mousedown",b=g?"touchend touchcancel":"mouseup mouseleave",w=g?"touchmove":"mousemove",y="finger",C=e("html")[0],k={},x={},$=e.Finger={pressDuration:300,doubleTapInterval:300,flickDuration:150,motionThreshold:5};e.event.add(C,m+"."+y,l)}(jQuery,navigator.userAgent),function(e){e.fn.stupidtable=function(i){return this.each(function(){var t=e(this);i=i||{},i=e.extend({},e.fn.stupidtable.default_sort_fns,i),t.on("click.stupidtable","thead th",function(){var n=e(this),s=0,l=e.fn.stupidtable.dir;n.parents("tr").find("th").slice(0,n.index()).each(function(){var i=e(this).attr("colspan")||1;s+=parseInt(i,10)});var a=n.data("sort-default")||l.ASC;n.data("sort-dir")&&(a=n.data("sort-dir")===l.ASC?l.DESC:l.ASC);var o=n.data("sort")||null;null!==o&&(t.trigger("beforetablesort",{column:s,direction:a}),t.css("display"),setTimeout(function(){var r=[],d=i[o],c=t.children("tbody").children("tr");c.each(function(i,t){var n=e(t).children().eq(s),l=n.data("sort-value"),a="undefined"!=typeof l?l:n.text();r.push([a,t])}),r.sort(function(e,i){return d(e[0],i[0])}),a!=l.ASC&&r.reverse(),c=e.map(r,function(e){return e[1]}),t.children("tbody").append(c),t.find("th").data("sort-dir",null).removeClass("sorting-desc sorting-asc"),n.data("sort-dir",a).addClass("sorting-"+a),t.trigger("aftertablesort",{column:s,direction:a}),t.css("display")},10))})})},e.fn.stupidtable.dir={ASC:"asc",DESC:"desc"},e.fn.stupidtable.default_sort_fns={"int":function(e,i){return parseInt(e,10)-parseInt(i,10)},"float":function(e,i){return parseFloat(e)-parseFloat(i)},string:function(e,i){return e.localeCompare(i)},"string-ins":function(e,i){return e=e.toLocaleLowerCase(),i=i.toLocaleLowerCase(),e.localeCompare(i)}}}(jQuery),$.fn.toggleAttr=function(e,i){return i?this.attr(e,e):"undefined"!=typeof i?this.removeAttr(e):this.each(function(){var i=$(this);"undefined"==typeof i.attr(e)?i.attr(e,e):i.removeAttr(e)})},$(function(){var e={lines:13,length:6,width:2,radius:6,corners:1,hwaccel:!0},i={init:function(){this.bindUIActions()},bindUIActions:function(){$("body").on("change",".file-upload",this.uploadFiles),$("body").on("click",".btn-remove",this.removeFileReference),$("body").on("click",".load_existing",this.loadExisting),$("body").on("doubletap",".is-directory",this.loadExisting),$("body").on("click",".breadcrumb a, .error-no-results a[data-uri]",this.loadExisting),$("body").on("tap",".view-list td",this.highlightRow),$("body").on("tap",".view-list td a",this.preventHighlightRow),$("body").on("click",'[data-action="select_file"]',this.selectFile),$("body").on("click",'[data-action="go-back"]',this.goBack)},prepareUpload:function(e){var i=e.target.files,t=$(this).closest(".fileclerk").find(".btn-upload");t.removeClass("is-hidden"),console.log(i)},fileCheck:function(e,i){$.ajax({url:"/TRIGGER/fileclerk/filecheck",type:"GET",data:{destination:e,filename:i},cache:!1,dataType:"JSON",processData:!0,contentType:!1,success:function(e){if(700===e.code);else if(300===e.code)return console.log(e),e.error},error:function(){return!1}})},uploadFiles:function(e){e.preventDefault();var t=$(this),n=t.closest(".fileclerk"),s=t.val(),l=s.split("\\"),a=l[l.length-1],o=t.closest(".view-upload"),r=o.find(".postUrl").val(),d=o.find(".postUrl").data("destination"),c=o.find(".file-wrapper"),f=o.find(".progress-bar"),u=f.find("progress"),p=f.find(".prc"),h=n.find(".result .filename-display .filename"),v=n.find(".result input.successful-upload"),g=n.find(".result"),m=n.find(".add-file"),b=m.find(".nav-tabs li:nth-child(2) a"),w=n.find(".upload-error"),y=n.find(".preview"),C=n.find(".inline-preview .load img"),k=n.find(".result input.hidden-url"),x=n.find(".result input.hidden-filename"),D=n.find(".result input.hidden-extension"),T=n.find(".result input.hidden-size"),E=n.find(".result input.hidden-size-bytes"),R=n.find(".result input.hidden-size-kilobytes"),S=n.find(".result input.hidden-size-megabytes"),j=n.find(".result input.hidden-size-gigabytes"),z=n.find(".result input.hidden-is-image");if(""!==a){var I=new FormData;$.each(t[0].files,function(e,i){I.append("file-"+e,i)});var A=function(e){"undefined"!=typeof e&&(r=r+"&overwrite="+e),$.ajax({url:r,type:"POST",data:I,cache:!1,dataType:"JSON",xhr:function(){var e=$.ajaxSettings.xhr();return e.upload.onprogress=function(e){var i=parseInt(e.loaded/e.total*100);console.log("Uploading: ",e.loaded/e.total*100+"%"),u.attr({value:e.loaded,max:e.total}),p.html(i+"%")},e.upload.onload=function(){console.log("DONE!")},e},processData:!1,contentType:!1,beforeSend:function(){c.removeClass("is-visible").addClass("is-hidden"),f.toggleClass("is-hidden is-visible")},success:function(e){100===e.code?(console.log(e.success),console.log("URL: "+e.data.fullpath),f.toggleClass("is-visible is-hidden"),h.append(e.data.filename),v.val(e.data.fullpath),h.attr("href",e.data.fullpath),m.toggleClass("is-visible is-hidden"),g.toggleClass("is-hidden is-visible"),n.addClass("yay"),y.removeClass("is-hidden").addClass("is-visible"),k.val(e.data.fullpath),x.val(e.data.filename),D.val(e.data.extension),T.val(e.data.size),E.val(e.data.size_bytes),R.val(e.data.size_kilobytes),S.val(e.data.size_megabytes),j.val(e.data.size_gigabytes),z.val(e.data.is_image),y.attr("href",e.data.fullpath),C.attr("src",""),"true"===z.val()||"1"===z.val()?(y.unbind(),y.attr("rel","inline")):(y.unbind(),y.attr("rel","external"))):200===e.code||(300===e.code?(console.log(e.message),w.toggleClass("is-hidden is-visible").html(e.html),f.toggleClass("is-visible is-hidden"),t.closest(".fileclerk").find(".upload-error .error-exists a").on("click",function(e){var i=$(this).attr("data-action");"replace"===i&&(console.log("Replace"),A(!0),w.toggleClass("is-visible is-hidden")),"keep-both"===i&&(console.log("Keep Both"),A(!1),w.toggleClass("is-visible is-hidden")),"cancel"===i&&(console.log("Cancel"),w.toggleClass("is-visible is-hidden"),c.removeClass("is-hidden").addClass("is-visible")),e.preventDefault()})):700===e.code?(console.log(e.message),w.toggleClass("is-hidden is-visible").html(e.html),f.toggleClass("is-visible is-hidden"),t.closest(".fileclerk").find(".upload-error .error-not-allowed a").on("click",function(e){var i=$(this).attr("data-action");"cancel"===i&&(console.log("Cancel"),w.toggleClass("is-visible is-hidden"),c.toggleClass("is-hidden is-visible")),e.preventDefault()})):console.log("ERRORS: "+e.error))},error:function(e,i){console.log("ERRORS: "+i)}})},N=function(){$.ajax({url:"/TRIGGER/fileclerk/filecheck",type:"GET",data:{destination:d,filename:a},cache:!1,dataType:"JSON",processData:!0,contentType:!1,async:!1,beforeSend:function(){},success:function(i){300===i.code?(e.preventDefault(),console.log(i),console.log(i.message),c.toggleClass("is-visible is-hidden"),w.toggleClass("is-hidden is-visible").html(i.html),b.removeAttr("data-toggle").addClass("disabled"),t.closest(".fileclerk").find(".upload-error .error-exists a").on("click",function(e){var i=$(this).attr("data-action");console.log(i),"replace"===i&&(console.log("Replace"),A(!0),w.toggleClass("is-visible is-hidden")),"keep-both"===i&&(console.log("Keep Both"),A(!1),w.toggleClass("is-visible is-hidden")),"cancel"===i&&(console.log("Cancel"),w.toggleClass("is-visible is-hidden"),c.toggleClass("is-hidden is-visible")),b.attr("data-toggle","tab").removeClass("disabled"),e.preventDefault()})):700===i.code?(console.log(i.message),c.removeClass("is-visible").addClass("is-hidden"),w.toggleClass("is-hidden is-visible").html(i.html),t.closest(".fileclerk").find(".upload-error .error-not-allowed a").on("click",function(e){var i=$(this).attr("data-action");"cancel"===i&&(console.log("Cancel"),w.toggleClass("is-visible is-hidden"),c.toggleClass("is-hidden is-visible")),e.preventDefault()})):800===i.code&&A(!1)},error:function(e,i,t){return console.log(t.stack),!1}})};N(),i.resetFormElement(t)}},resetFormElement:function(e){e.wrap("
").parent("form").trigger("reset"),e.unwrap()},removeFileReference:function(e){var i=$(this),t=i.closest(".fileclerk"),n=i.closest(".fileclerk").find(".result"),s=i.closest(".fileclerk").find(".add-file"),l=i.closest(".fileclerk").find(".result input.successful-upload"),a=i.closest(".fileclerk").find('.result input[type="hidden"]'),o=i.closest(".fileclerk").find(".result .filename-display .filename"),r=i.closest(".fileclerk").find(".file-wrapper");e.preventDefault(),l.val(""),a.val(""),o.html(""),n.toggleClass("is-visible is-hidden"),setTimeout(function(){s.toggleClass("is-hidden is-visible"),r.removeClass("is-hidden").addClass("is-visible"),t.removeClass("yay")},300)},loadExisting:function(i){i.preventDefault();var t=$(this),n="/TRIGGER/fileclerk/list"+($(this).data("uri")?"?uri="+$(this).data("uri"):"")+($(this).data("uri")?"&":"?")+($(this).data("destination")?"destination="+$(this).data("destination"):""),s=t.closest(".add-file").find(".view-remote .view-list"),l=s.find("table"),a=s.find("tbody"),o=s.find(".error-no-results"),r=t.closest(".add-file").find(".view-remote .breadcrumb"),d=t.closest(".add-file").find(".view-remote .ajax-spinner"),c=t.closest(".add-file").find(".view-remote .ajax-overlay");$.ajax({url:n,type:"GET",cache:!1,dataType:"json",processData:!1,contentType:!1,beforeSend:function(){d.spin(e),c.toggleClass("is-hidden is-visible")},success:function(e){400===e.code||e.error===!1?(console.log(e.success),o.remove(),r.html(e.breadcrumb),l.removeClass("is-hidden"),a.html(e.html),d.spin(!1),c.toggleClass("is-visible is-hidden")):500===e.code?(r.html(e.breadcrumb),o.remove(),$(e.html).prependTo(s),l.addClass("is-hidden"),a.empty(),d.spin(!1),c.toggleClass("is-visible is-hidden")):600===e.code},error:function(e,i){console.log("ERRORS: "+i)}})},highlightRow:function(){var e=$(this),i="is-highlighted",t=e.closest("tr").siblings(),n=e.parent("tr"),s=e.closest("tbody").find("tr"),l=e.closest(".view-remote").find('button[data-action="select_file"]');t.removeClass(i),n.toggleClass(i),s.hasClass(i)&&!n.hasClass("directory")?l.prop("disabled",!1):l.prop("disabled",!0)},preventHighlightRow:function(e){e.stopPropagation()},selectFile:function(e){e.preventDefault();var i=$(this),t=i.closest(".fileclerk"),n=i.closest(".view-remote"),s=n.find(".view-list table tr.file.is-highlighted").data("file"),l=n.find(".view-list table tr.file.is-highlighted td.is-file .filename").html(),a=n.find(".view-list table tr.file.is-highlighted").data("extension"),o=n.find(".view-list table tr.file.is-highlighted").data("is-image"),r=n.find(".view-list table tr.file.is-highlighted").data("size"),d=n.find(".view-list table tr.file.is-highlighted").data("size-bytes"),c=n.find(".view-list table tr.file.is-highlighted").data("size-kilobytes"),f=n.find(".view-list table tr.file.is-highlighted").data("size-megabytes"),u=n.find(".view-list table tr.file.is-highlighted").data("size-gigabytes"),p=t.find(".result .filename-display .filename"),h=t.find(".result input.successful-upload"),v=t.find(".result"),g=t.find(".add-file"),m=t.find(".preview"),b=t.find(".inline-preview .load img"),w=t.find(".result input.hidden-url"),y=t.find(".result input.hidden-filename"),C=t.find(".result input.hidden-extension"),k=t.find(".result input.hidden-size"),x=t.find(".result input.hidden-size-bytes"),D=t.find(".result input.hidden-size-kilobytes"),T=t.find(".result input.hidden-size-megabytes"),E=t.find(".result input.hidden-size-gigabytes"),R=t.find(".result input.hidden-is-image");p.append(l),h.val(s),w.val(s),y.val(l),C.val(a),R.val(o),k.val(r),x.val(d),D.val(c),T.val(f),E.val(u),p.attr("href",s),m.removeClass("is-hidden").addClass("is-visible"),g.toggleClass("is-visible is-hidden"),v.toggleClass("is-hidden is-visible"),t.addClass("yay"),m.attr("href",s),b.attr("src",""),"true"===R.val()||"1"===R.val()?(m.unbind(),m.attr("rel","inline")):(m.unbind(),m.attr("rel","external")),console.log(l+" selected")},fileExists:function(e){var i=$(this),t=i.attr("data-action"),n=i.closest(".fileclerk").find(".upload-error"),s=i.closest(".fileclerk").find(".upload-error .error-exists"),l=i.closest(".fileclerk").find(".file-wrapper");"replace"===t&&console.log("Replace"),"keep-both"===t&&console.log("Keep Both"),"cancel"===t&&(console.log("Cancel"),s.remove(),n.toggleClass("is-visible is-hidden"),l.toggleClass("is-hidden is-visible")),e.preventDefault()},goBack:function(e){var i=$(this),t=i.closest(".error-no-results"),n=i.closest(".fileclerk").find(".nav-tabs li:nth-child(1) a").attr("href");$('a[href="'+n+'"]').tab("show"),t.remove(),e.preventDefault()}};i.init();var t=function(e){var i="^(\\d{1,2})\\/(\\d{1,2})\\/(\\d{2,4})\\s*(\\d{1,2}):(\\d{1,2})\\s*(am|pm|AM|PM|Am|Pm)$",t=new RegExp(i);if(t.test(e)){var n=t.exec(e).slice(1),s=n[0],l=n[1],a=n[2],o=n[3],r=n[4],d=n[5],c=s+" "+l+" "+a+" "+o+":"+r+":00 "+d;return new Date(c)}return!1},n=function(e){var i=e.split(" "),t=i[0].replace(/,/g,""),n=i[1],s=8;return"KB"===n?s=1024:"MB"===n?s=1048576:"GB"===n&&(s=1073741824),parseInt(t*s,10)};$(".tablesort").stupidtable({date:function(e,i){var n=t(e),s=t(i);return n-s},size:function(e,i){var t=n(e),s=n(i);return t-s}});var s={init:function(){this.bindUIActions()},bindUIActions:function(){$("body").on("click",'.fileclerk a.preview[rel="inline"]',this.showInlinePreview),$("body").on("click",".fileclerk .inline-preview .modal-close",this.hideInlinePreview),$(document).keyup(function(e){if(27===e.keyCode){var i=$(".fileclerk .inline-preview"),t=$(".fileclerk .preview"),n=$(".fileclerk .view-remote .ajax-overlay.is-visible"),s=$(".fileclerk").find(".inline-preview.is-visible .load");i.removeClass("is-visible").addClass("is-hidden"),t.removeClass("active"),n.toggleClass("is-visible is-hidden"),s.html("")}}),$(document).on("click",function(e){if(!$(e.target).closest(".fileclerk .inline-preview").length){var i=$(".fileclerk .inline-preview"),t=$(".fileclerk .preview"),n=$(e.target).closest(".fileclerk .view-remote .ajax-overlay.is-visible"),s=$(".fileclerk").find(".inline-preview.is-visible .load");i.removeClass("is-visible").addClass("is-hidden"),t.removeClass("active"),n.toggleClass("is-visible is-hidden"),s.html("")}})},showInlinePreview:function(i){var t=$(this),n=t.attr("href"),s=$(".fileclerk .inline-preview"),l=$(".fileclerk .result .preview"),a=$("html, body"),o=t.closest(".fileclerk"),r=o.find(".inline-preview .load"),d=o.find(".result .inline-preview"),c=o.find(".inline-preview .load .ajax-spinner"),f=t.closest("tr.file"),u=$(".fileclerk").find(".view-remote .inline-preview .load"),p=$(".fileclerk").find(".view-remote .inline-preview"),h=f.find(".inline-preview .load .ajax-spinner"),v=t.closest(".fileclerk").find("table.tablesort"),g=t.closest(".fileclerk").find(".view-remote .ajax-overlay");s.removeClass("is-visible").addClass("is-hidden"),l.removeClass("active"),t.hasClass("preview--is-selected")&&(d.toggleClass("is-hidden is-visible"),t.addClass("active"),a.animate({scrollTop:d.offset().top-20},500),$.ajax({url:"/TRIGGER/fileclerk/ajaxpreview?url="+n,cache:!1,dataType:"JSON",beforeSend:function(){c.spin(e)},success:function(e){r.html(''),console.log(e),c.spin(!1)}})),t.hasClass("preview--choose-existing")&&(p.toggleClass("is-hidden is-visible"),t.addClass("active"),v.animate({scrollTop:p.offset().top-20},500),$.ajax({url:"/TRIGGER/fileclerk/ajaxpreview?url="+n,cache:!1,dataType:"JSON",beforeSend:function(){h.spin(e),g.toggleClass("is-hidden is-visible")},success:function(e){u.html(''),console.log(e),h.spin(!1)}})),i.preventDefault(),i.stopPropagation()},hideInlinePreview:function(e){var i=$(this),t=i.closest(".fileclerk"),n=t.find(".inline-preview.is-visible"),s=t.find(".inline-preview.is-visible .load"),l=t.find(".preview.active"),a=t.find(".view-remote .ajax-overlay");n.toggleClass("is-visible is-hidden"),s.html(""),l.removeClass("active"),a.toggleClass("is-visible is-hidden"),e.preventDefault(),e.stopPropagation()}};s.init();var l={init:function(){this.bindUIActions()},bindUIActions:function(){$("body").on("click",'.fileclerk a[rel="external"]',this.previewExternal)},previewExternal:function(e){e.preventDefault(),e.stopPropagation(),window.open(this.href,"_blank")}};l.init();var a={init:function(){this.bindUIActions()},bindUIActions:function(){$("body").on("click",'.fileclerk .nav-tabs a[data-tab="nav-upload"]',this.showUploadContainer),$("body").on("click",'.fileclerk .nav-tabs a[data-tab="nav-choose"]',this.showChooseContainer)},showUploadContainer:function(e){var i=$(this),t=i.closest(".fileclerk"),n=t.find(".nav-tabs li"),s=i.parent("li"),l=t.find(".tab-pane"),a=t.find(".tab-pane.view-upload");n.removeClass("active"),s.addClass("active"),l.removeClass("active"),a.addClass("active fade in"),e.preventDefault(),e.stopPropagation()},showChooseContainer:function(e){var i=$(this),t=i.closest(".fileclerk"),n=t.find(".nav-tabs li"),s=i.parent("li"),l=t.find(".tab-pane"),a=t.find(".tab-pane.view-remote");n.removeClass("active"),s.addClass("active"),l.removeClass("active"),a.addClass("active fade in"),e.preventDefault(),e.stopPropagation()}};a.init()}); \ No newline at end of file +!function(){for(var e,i=function(){},t=["assert","clear","count","debug","dir","dirxml","error","exception","group","groupCollapsed","groupEnd","info","log","markTimeline","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"],n=t.length,s=window.console=window.console||{};n--;)e=t[n],s[e]||(s[e]=i)}(),function(e,i){"object"==typeof exports?module.exports=i():"function"==typeof define&&define.amd?define(i):e.Spinner=i()}(this,function(){"use strict";function e(e,i){var t,n=document.createElement(e||"div");for(t in i)n[t]=i[t];return n}function i(e){for(var i=1,t=arguments.length;t>i;i++)e.appendChild(arguments[i]);return e}function t(e,i,t,n){var s=["opacity",i,~~(100*e),t,n].join("-"),l=.01+t/n*100,a=Math.max(1-(1-e)/i*(100-l),e),o=d.substring(0,d.indexOf("Animation")).toLowerCase(),r=o&&"-"+o+"-"||"";return f[s]||(u.insertRule("@"+r+"keyframes "+s+"{0%{opacity:"+a+"}"+l+"%{opacity:"+e+"}"+(l+.01)+"%{opacity:1}"+(l+i)%100+"%{opacity:"+e+"}100%{opacity:"+a+"}}",u.cssRules.length),f[s]=1),s}function n(e,i){var t,n,s=e.style;for(i=i.charAt(0).toUpperCase()+i.slice(1),n=0;n',t)}u.addRule(".spin-vml","behavior:url(#default#VML)"),o.prototype.lines=function(e,n){function l(){return s(t("group",{coordsize:c+" "+c,coordorigin:-d+" "+-d}),{width:c,height:c})}function o(e,o,r){i(u,i(s(l(),{rotation:360/n.lines*e+"deg",left:~~o}),i(s(t("roundrect",{arcsize:n.corners}),{width:d,height:n.width,left:n.radius,top:-n.width>>1,filter:r}),t("fill",{color:a(n.color,e),opacity:n.opacity}),t("stroke",{opacity:0}))))}var r,d=n.length+n.width,c=2*d,f=2*-(n.width+n.length)+"px",u=s(l(),{position:"absolute",top:f,left:f});if(n.shadow)for(r=1;r<=n.lines;r++)o(r,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(r=1;r<=n.lines;r++)o(r);return i(e,u)},o.prototype.opacity=function(e,i,t,n){var s=e.firstChild;n=n.shadow&&n.lines||0,s&&i+n>1)+"px"})}for(var r,c=0,f=(l.lines-1)*(1-l.direction)/2;c$.motionThreshold||x.ady>$.motionThreshold){for(clearTimeout(f),x.orientation||(x.adx>x.ady?(x.orientation="horizontal",x.direction=x.dx>0?1:-1):(x.orientation="vertical",x.direction=x.dy>0?1:-1));i.target&&i.target!==k.target;)i.target=i.target.parentNode;return i.target!==k.target?(i.target=k.target,void o.call(this,e.Event(b+"."+y,i))):void s(i,"drag")}}function o(e){var i,t=e.timeStamp||+new Date,n=t-k.time;if(clearTimeout(f),r||d||e.target!==k.target)e.target=k.target,n<$.flickDuration&&s(e,"flick"),x.end=!0,i="drag";else{var l=u===e.target&&t-p<$.doubleTapInterval;i=l?"doubletap":"tap",u=l?null:k.target,p=t}s(e,i,!0)}var r,d,c,f,u,p,h=/chrome/i.exec(i),v=/android/i.exec(i),g="ontouchstart"in window&&!(h&&!v),m=g?"touchstart":"mousedown",b=g?"touchend touchcancel":"mouseup mouseleave",w=g?"touchmove":"mousemove",y="finger",C=e("html")[0],k={},x={},$=e.Finger={pressDuration:300,doubleTapInterval:300,flickDuration:150,motionThreshold:5};e.event.add(C,m+"."+y,l)}(jQuery,navigator.userAgent),function(e){e.fn.stupidtable=function(i){return this.each(function(){var t=e(this);i=i||{},i=e.extend({},e.fn.stupidtable.default_sort_fns,i),t.on("click.stupidtable","thead th",function(){var n=e(this),s=0,l=e.fn.stupidtable.dir;n.parents("tr").find("th").slice(0,n.index()).each(function(){var i=e(this).attr("colspan")||1;s+=parseInt(i,10)});var a=n.data("sort-default")||l.ASC;n.data("sort-dir")&&(a=n.data("sort-dir")===l.ASC?l.DESC:l.ASC);var o=n.data("sort")||null;null!==o&&(t.trigger("beforetablesort",{column:s,direction:a}),t.css("display"),setTimeout(function(){var r=[],d=i[o],c=t.children("tbody").children("tr");c.each(function(i,t){var n=e(t).children().eq(s),l=n.data("sort-value"),a="undefined"!=typeof l?l:n.text();r.push([a,t])}),r.sort(function(e,i){return d(e[0],i[0])}),a!=l.ASC&&r.reverse(),c=e.map(r,function(e){return e[1]}),t.children("tbody").append(c),t.find("th").data("sort-dir",null).removeClass("sorting-desc sorting-asc"),n.data("sort-dir",a).addClass("sorting-"+a),t.trigger("aftertablesort",{column:s,direction:a}),t.css("display")},10))})})},e.fn.stupidtable.dir={ASC:"asc",DESC:"desc"},e.fn.stupidtable.default_sort_fns={"int":function(e,i){return parseInt(e,10)-parseInt(i,10)},"float":function(e,i){return parseFloat(e)-parseFloat(i)},string:function(e,i){return e.localeCompare(i)},"string-ins":function(e,i){return e=e.toLocaleLowerCase(),i=i.toLocaleLowerCase(),e.localeCompare(i)}}}(jQuery),$.fn.toggleAttr=function(e,i){return i?this.attr(e,e):"undefined"!=typeof i?this.removeAttr(e):this.each(function(){var i=$(this);"undefined"==typeof i.attr(e)?i.attr(e,e):i.removeAttr(e)})},$(function(){var e={lines:13,length:6,width:2,radius:6,corners:1,hwaccel:!0},i={init:function(){this.bindUIActions()},bindUIActions:function(){$("body").on("change",".file-upload",this.uploadFiles),$("body").on("click",".btn-remove",this.removeFileReference),$("body").on("click",".load_existing",this.loadExisting),$("body").on("doubletap",".is-directory",this.loadExisting),$("body").on("click",".breadcrumb a, .error-no-results a[data-uri]",this.loadExisting),$("body").on("tap",".view-list td",this.highlightRow),$("body").on("tap",".view-list td a",this.preventHighlightRow),$("body").on("click",'[data-action="select_file"]',this.selectFile),$("body").on("click",'[data-action="go-back"]',this.goBack)},prepareUpload:function(e){var i=e.target.files,t=$(this).closest(".fileclerk").find(".btn-upload");t.removeClass("is-hidden"),console.log(i)},fileCheck:function(e,i){$.ajax({url:_site_root+"TRIGGER/fileclerk/filecheck",type:"GET",data:{destination:e,filename:i},cache:!1,dataType:"JSON",processData:!0,contentType:!1,success:function(e,i,t){if(700===e.code);else if(300===e.code)return console.log(e),e.error},error:function(e,i,t){return!1}})},uploadFiles:function(e){e.preventDefault();var t=$(this),n=t.closest(".fileclerk"),s=t.val(),l=s.split("\\"),a=l[l.length-1],o=t.closest(".view-upload"),r=o.find(".postUrl").val(),d=o.find(".postUrl").data("destination"),c=o.find(".file-wrapper"),f=o.find(".progress-bar"),u=f.find("progress"),p=f.find(".prc"),h=n.find(".result .filename-display .filename"),v=n.find(".result input.successful-upload"),g=n.find(".result"),m=n.find(".add-file"),b=m.find(".nav-tabs li:nth-child(2) a"),w=n.find(".upload-error"),y=n.find(".preview"),C=n.find(".inline-preview .load img"),k=n.find(".result input.hidden-url"),x=n.find(".result input.hidden-filename"),D=n.find(".result input.hidden-extension"),T=n.find(".result input.hidden-size"),E=n.find(".result input.hidden-size-bytes"),R=n.find(".result input.hidden-size-kilobytes"),S=n.find(".result input.hidden-size-megabytes"),j=n.find(".result input.hidden-size-gigabytes"),z=n.find(".result input.hidden-is-image");if(""!==a){var I=new FormData;$.each(t[0].files,function(e,i){I.append("file-"+e,i)});var A=function(e){"undefined"!=typeof e&&(r=r+"&overwrite="+e),$.ajax({url:r,type:"POST",data:I,cache:!1,dataType:"JSON",xhr:function(){var e=$.ajaxSettings.xhr();return e.upload.onprogress=function(e){var i=parseInt(e.loaded/e.total*100);console.log("Uploading: ",e.loaded/e.total*100+"%"),u.attr({value:e.loaded,max:e.total}),p.html(i+"%")},e.upload.onload=function(){console.log("DONE!")},e},processData:!1,contentType:!1,beforeSend:function(e){c.removeClass("is-visible").addClass("is-hidden"),f.toggleClass("is-hidden is-visible")},success:function(e,i,s){100===e.code?(console.log(e.success),console.log("URL: "+e.data.fullpath),f.toggleClass("is-visible is-hidden"),h.append(e.data.filename),v.val(e.data.fullpath),h.attr("href",e.data.fullpath),m.toggleClass("is-visible is-hidden"),g.toggleClass("is-hidden is-visible"),n.addClass("yay"),y.removeClass("is-hidden").addClass("is-visible"),k.val(e.data.fullpath),x.val(e.data.filename),D.val(e.data.extension),T.val(e.data.size),E.val(e.data.size_bytes),R.val(e.data.size_kilobytes),S.val(e.data.size_megabytes),j.val(e.data.size_gigabytes),z.val(e.data.is_image),y.attr("href",e.data.fullpath),C.attr("src",""),"true"===z.val()||"1"===z.val()?(y.unbind(),y.attr("rel","inline")):(y.unbind(),y.attr("rel","external"))):200===e.code||(300===e.code?(console.log(e.message),w.toggleClass("is-hidden is-visible").html(e.html),f.toggleClass("is-visible is-hidden"),t.closest(".fileclerk").find(".upload-error .error-exists a").on("click",function(e){var i=$(this).attr("data-action");"replace"===i&&(console.log("Replace"),A(!0),w.toggleClass("is-visible is-hidden")),"keep-both"===i&&(console.log("Keep Both"),A(!1),w.toggleClass("is-visible is-hidden")),"cancel"===i&&(console.log("Cancel"),w.toggleClass("is-visible is-hidden"),c.removeClass("is-hidden").addClass("is-visible")),e.preventDefault()})):700===e.code?(console.log(e.message),w.toggleClass("is-hidden is-visible").html(e.html),f.toggleClass("is-visible is-hidden"),t.closest(".fileclerk").find(".upload-error .error-not-allowed a").on("click",function(e){var i=$(this).attr("data-action");"cancel"===i&&(console.log("Cancel"),w.toggleClass("is-visible is-hidden"),c.toggleClass("is-hidden is-visible")),e.preventDefault()})):console.log("ERRORS: "+e.error))},error:function(e,i,t){console.log("ERRORS: "+i)}})},_=function(){$.ajax({url:_site_root+"TRIGGER/fileclerk/filecheck",type:"GET",data:{destination:d,filename:a},cache:!1,dataType:"JSON",processData:!0,contentType:!1,async:!1,beforeSend:function(e){},success:function(i,n,s){300===i.code?(e.preventDefault(),console.log(i),console.log(i.message),c.toggleClass("is-visible is-hidden"),w.toggleClass("is-hidden is-visible").html(i.html),b.removeAttr("data-toggle").addClass("disabled"),t.closest(".fileclerk").find(".upload-error .error-exists a").on("click",function(e){var i=$(this).attr("data-action");console.log(i),"replace"===i&&(console.log("Replace"),A(!0),w.toggleClass("is-visible is-hidden")),"keep-both"===i&&(console.log("Keep Both"),A(!1),w.toggleClass("is-visible is-hidden")),"cancel"===i&&(console.log("Cancel"),w.toggleClass("is-visible is-hidden"),c.toggleClass("is-hidden is-visible")),b.attr("data-toggle","tab").removeClass("disabled"),e.preventDefault()})):700===i.code?(console.log(i.message),c.removeClass("is-visible").addClass("is-hidden"),w.toggleClass("is-hidden is-visible").html(i.html),t.closest(".fileclerk").find(".upload-error .error-not-allowed a").on("click",function(e){var i=$(this).attr("data-action");"cancel"===i&&(console.log("Cancel"),w.toggleClass("is-visible is-hidden"),c.toggleClass("is-hidden is-visible")),e.preventDefault()})):800===i.code&&A(!1)},error:function(e,i,t){return console.log(t.stack),!1}})};_(),i.resetFormElement(t)}},resetFormElement:function(e){e.wrap("").parent("form").trigger("reset"),e.unwrap()},removeFileReference:function(e){var i=$(this),t=i.closest(".fileclerk"),n=i.closest(".fileclerk").find(".result"),s=i.closest(".fileclerk").find(".add-file"),l=i.closest(".fileclerk").find(".result input.successful-upload"),a=i.closest(".fileclerk").find('.result input[type="hidden"]'),o=i.closest(".fileclerk").find(".result .filename-display .filename"),r=i.closest(".fileclerk").find(".file-wrapper");e.preventDefault(),l.val(""),a.val(""),o.html(""),n.toggleClass("is-visible is-hidden"),setTimeout(function(){s.toggleClass("is-hidden is-visible"),r.removeClass("is-hidden").addClass("is-visible"),t.removeClass("yay")},300)},loadExisting:function(i){i.preventDefault();var t=$(this),n=_site_root+"TRIGGER/fileclerk/list"+($(this).data("uri")?"?uri="+$(this).data("uri"):"")+($(this).data("uri")?"&":"?")+($(this).data("destination")?"destination="+$(this).data("destination"):""),s=t.closest(".add-file").find(".view-remote .view-list"),l=s.find("table"),a=s.find("tbody"),o=s.find(".error-no-results"),r=t.closest(".add-file").find(".view-remote .breadcrumb"),d=t.closest(".add-file").find(".view-remote .ajax-spinner"),c=t.closest(".add-file").find(".view-remote .ajax-overlay");$.ajax({url:n,type:"GET",cache:!1,dataType:"json",processData:!1,contentType:!1,beforeSend:function(i){d.spin(e),c.toggleClass("is-hidden is-visible")},success:function(e,i,t){400===e.code||e.error===!1?(console.log(e.success),o.remove(),r.html(e.breadcrumb),l.removeClass("is-hidden"),a.html(e.html),d.spin(!1),c.toggleClass("is-visible is-hidden")):500===e.code?(r.html(e.breadcrumb),o.remove(),$(e.html).prependTo(s),l.addClass("is-hidden"),a.empty(),d.spin(!1),c.toggleClass("is-visible is-hidden")):600===e.code},error:function(e,i,t){console.log("ERRORS: "+i)}})},highlightRow:function(e){var i=$(this),t="is-highlighted",n=i.closest("tr").siblings(),s=i.parent("tr"),l=i.closest("tbody").find("tr"),a=i.closest(".view-remote").find('button[data-action="select_file"]');n.removeClass(t),s.toggleClass(t),l.hasClass(t)&&!s.hasClass("directory")?a.prop("disabled",!1):a.prop("disabled",!0)},preventHighlightRow:function(e){e.stopPropagation()},selectFile:function(e){e.preventDefault();var i=$(this),t=i.closest(".fileclerk"),n=i.closest(".view-remote"),s=n.find(".view-list table tr.file.is-highlighted").data("file"),l=n.find(".view-list table tr.file.is-highlighted td.is-file .filename").html(),a=n.find(".view-list table tr.file.is-highlighted").data("extension"),o=n.find(".view-list table tr.file.is-highlighted").data("is-image"),r=n.find(".view-list table tr.file.is-highlighted").data("size"),d=n.find(".view-list table tr.file.is-highlighted").data("size-bytes"),c=n.find(".view-list table tr.file.is-highlighted").data("size-kilobytes"),f=n.find(".view-list table tr.file.is-highlighted").data("size-megabytes"),u=n.find(".view-list table tr.file.is-highlighted").data("size-gigabytes"),p=t.find(".result .filename-display .filename"),h=t.find(".result input.successful-upload"),v=t.find(".result"),g=t.find(".add-file"),m=t.find(".preview"),b=t.find(".inline-preview .load img"),w=t.find(".result input.hidden-url"),y=t.find(".result input.hidden-filename"),C=t.find(".result input.hidden-extension"),k=t.find(".result input.hidden-size"),x=t.find(".result input.hidden-size-bytes"),D=t.find(".result input.hidden-size-kilobytes"),T=t.find(".result input.hidden-size-megabytes"),E=t.find(".result input.hidden-size-gigabytes"),R=t.find(".result input.hidden-is-image");p.append(l),h.val(s),w.val(s),y.val(l),C.val(a),R.val(o),k.val(r),x.val(d),D.val(c),T.val(f),E.val(u),p.attr("href",s),m.removeClass("is-hidden").addClass("is-visible"),g.toggleClass("is-visible is-hidden"),v.toggleClass("is-hidden is-visible"),t.addClass("yay"),m.attr("href",s),b.attr("src",""),"true"===R.val()||"1"===R.val()?(m.unbind(),m.attr("rel","inline")):(m.unbind(),m.attr("rel","external")),console.log(l+" selected")},fileExists:function(e){var i=$(this),t=i.attr("data-action"),n=i.closest(".fileclerk").find(".upload-error"),s=i.closest(".fileclerk").find(".upload-error .error-exists"),l=i.closest(".fileclerk").find(".file-wrapper");"replace"===t&&console.log("Replace"),"keep-both"===t&&console.log("Keep Both"),"cancel"===t&&(console.log("Cancel"),s.remove(),n.toggleClass("is-visible is-hidden"),l.toggleClass("is-hidden is-visible")),e.preventDefault()},goBack:function(e){var i=$(this),t=i.closest(".error-no-results"),n=i.closest(".fileclerk").find(".nav-tabs li:nth-child(1) a").attr("href");$('a[href="'+n+'"]').tab("show"),t.remove(),e.preventDefault()}};i.init();var t=function(e){var i="^(\\d{1,2})\\/(\\d{1,2})\\/(\\d{2,4})\\s*(\\d{1,2}):(\\d{1,2})\\s*(am|pm|AM|PM|Am|Pm)$",t=new RegExp(i);if(t.test(e)){var n=t.exec(e).slice(1),s=n[0],l=n[1],a=n[2],o=n[3],r=n[4],d=n[5],c=s+" "+l+" "+a+" "+o+":"+r+":00 "+d;return new Date(c)}return!1},n=function(e){var i=e.split(" "),t=i[0].replace(/,/g,""),n=i[1],s=8;return"KB"===n?s=1024:"MB"===n?s=1048576:"GB"===n&&(s=1073741824),parseInt(t*s,10)};$(".tablesort").stupidtable({date:function(e,i){var n=t(e),s=t(i);return n-s},size:function(e,i){var t=n(e),s=n(i);return t-s}});var s={init:function(){this.bindUIActions()},bindUIActions:function(){$("body").on("click",'.fileclerk a.preview[rel="inline"]',this.showInlinePreview),$("body").on("click",".fileclerk .inline-preview .modal-close",this.hideInlinePreview),$(document).keyup(function(e){if(27===e.keyCode){var i=$(".fileclerk .inline-preview"),t=$(".fileclerk .preview"),n=$(".fileclerk .view-remote .ajax-overlay.is-visible"),s=$(".fileclerk").find(".inline-preview.is-visible .load");i.removeClass("is-visible").addClass("is-hidden"),t.removeClass("active"),n.toggleClass("is-visible is-hidden"),s.html("")}}),$(document).on("click",function(e){if(!$(e.target).closest(".fileclerk .inline-preview").length){var i=$(".fileclerk .inline-preview"),t=$(".fileclerk .preview"),n=$(e.target).closest(".fileclerk .view-remote .ajax-overlay.is-visible"),s=$(".fileclerk").find(".inline-preview.is-visible .load");i.removeClass("is-visible").addClass("is-hidden"),t.removeClass("active"),n.toggleClass("is-visible is-hidden"),s.html("")}})},showInlinePreview:function(i){var t=$(this),n=t.attr("href"),s=$(".fileclerk .inline-preview"),l=$(".fileclerk .result .preview"),a=$("html, body"),o=t.closest(".fileclerk"),r=o.find(".inline-preview .load"),d=o.find(".result .inline-preview"),c=o.find(".inline-preview .load .ajax-spinner"),f=t.closest("tr.file"),u=$(".fileclerk").find(".view-remote .inline-preview .load"),p=$(".fileclerk").find(".view-remote .inline-preview"),h=f.find(".inline-preview .load .ajax-spinner"),v=t.closest(".fileclerk").find("table.tablesort"),g=t.closest(".fileclerk").find(".view-remote .ajax-overlay");s.removeClass("is-visible").addClass("is-hidden"),l.removeClass("active"),t.hasClass("preview--is-selected")&&(d.toggleClass("is-hidden is-visible"),t.addClass("active"),a.animate({scrollTop:d.offset().top-20},500),$.ajax({url:_site_root+"TRIGGER/fileclerk/ajaxpreview?url="+n,cache:!1,dataType:"JSON",beforeSend:function(i){c.spin(e)},success:function(e){r.html(''),console.log(e),c.spin(!1)}})),t.hasClass("preview--choose-existing")&&(p.toggleClass("is-hidden is-visible"),t.addClass("active"),v.animate({scrollTop:p.offset().top-20},500),$.ajax({url:_site_root+"TRIGGER/fileclerk/ajaxpreview?url="+n,cache:!1,dataType:"JSON",beforeSend:function(i){h.spin(e),g.toggleClass("is-hidden is-visible")},success:function(e){u.html(''),console.log(e),h.spin(!1)}})),i.preventDefault(),i.stopPropagation()},hideInlinePreview:function(e){var i=$(this),t=i.closest(".fileclerk"),n=t.find(".inline-preview.is-visible"),s=t.find(".inline-preview.is-visible .load"),l=t.find(".preview.active"),a=t.find(".view-remote .ajax-overlay");n.toggleClass("is-visible is-hidden"),s.html(""),l.removeClass("active"),a.toggleClass("is-visible is-hidden"),e.preventDefault(),e.stopPropagation()}};s.init();var l={init:function(){this.bindUIActions()},bindUIActions:function(){$("body").on("click",'.fileclerk a[rel="external"]',this.previewExternal)},previewExternal:function(e){e.preventDefault(),e.stopPropagation(),window.open(this.href,"_blank")}};l.init();var a={init:function(){this.bindUIActions()},bindUIActions:function(){$("body").on("click",'.fileclerk .nav-tabs a[data-tab="nav-upload"]',this.showUploadContainer),$("body").on("click",'.fileclerk .nav-tabs a[data-tab="nav-choose"]',this.showChooseContainer)},showUploadContainer:function(e){var i=$(this),t=i.closest(".fileclerk"),n=t.find(".nav-tabs li"),s=i.parent("li"),l=t.find(".tab-pane"),a=t.find(".tab-pane.view-upload");n.removeClass("active"),s.addClass("active"),l.removeClass("active"),a.addClass("active fade in"),e.preventDefault(),e.stopPropagation()},showChooseContainer:function(e){var i=$(this),t=i.closest(".fileclerk"),n=t.find(".nav-tabs li"),s=i.parent("li"),l=t.find(".tab-pane"),a=t.find(".tab-pane.view-remote");n.removeClass("active"),s.addClass("active"),l.removeClass("active"),a.addClass("active fade in"),e.preventDefault(),e.stopPropagation()}};a.init()}); \ No newline at end of file diff --git a/_add-ons/fileclerk/js/fileclerk.js b/_add-ons/fileclerk/js/fileclerk.js index c11c923..685b30d 100644 --- a/_add-ons/fileclerk/js/fileclerk.js +++ b/_add-ons/fileclerk/js/fileclerk.js @@ -107,7 +107,7 @@ $(function () { fileCheck: function( destination, filename ) { $.ajax({ - url: '/TRIGGER/fileclerk/filecheck', + url: _site_root + 'TRIGGER/fileclerk/filecheck', type: 'GET', data: {'destination': destination, 'filename': filename}, cache: false, @@ -341,7 +341,7 @@ $(function () { var doFileCheck = function() { $.ajax({ - url: '/TRIGGER/fileclerk/filecheck', + url: _site_root + 'TRIGGER/fileclerk/filecheck', type: 'GET', data: {'destination': destination, 'filename': filename}, cache: false, @@ -482,7 +482,7 @@ $(function () { event.preventDefault(); var $this = $(this), - listURL = '/TRIGGER/fileclerk/list' + ($(this).data('uri') ? '?uri=' + $(this).data('uri') : '') + ($(this).data('uri') ? '&' : '?') + ($(this).data('destination') ? 'destination=' + $(this).data('destination') : ''), + listURL = _site_root + 'TRIGGER/fileclerk/list' + ($(this).data('uri') ? '?uri=' + $(this).data('uri') : '') + ($(this).data('uri') ? '&' : '?') + ($(this).data('destination') ? 'destination=' + $(this).data('destination') : ''), viewList = $this.closest('.add-file').find('.view-remote .view-list'), viewListTable = viewList.find('table'), viewListTableBody = viewList.find('tbody'), @@ -850,7 +850,7 @@ $(function () { // Get external image $.ajax({ - url: '/TRIGGER/fileclerk/ajaxpreview?url=' + externalUrl, + url: _site_root + 'TRIGGER/fileclerk/ajaxpreview?url=' + externalUrl, cache: false, dataType: 'JSON', // JSON beforeSend: function(data) { @@ -879,7 +879,7 @@ $(function () { // Get external image $.ajax({ - url: '/TRIGGER/fileclerk/ajaxpreview?url=' + externalUrl, + url: _site_root + 'TRIGGER/fileclerk/ajaxpreview?url=' + externalUrl, cache: false, dataType: 'JSON', // JSON beforeSend: function(data) { diff --git a/_add-ons/fileclerk/views/ft.fileclerk.html b/_add-ons/fileclerk/views/ft.fileclerk.html index 099b1af..8fe588a 100644 --- a/_add-ons/fileclerk/views/ft.fileclerk.html +++ b/_add-ons/fileclerk/views/ft.fileclerk.html @@ -91,4 +91,8 @@ + + \ No newline at end of file