mirror of
https://github.com/eldarion/eldarion-ajax-demo.git
synced 2026-01-09 14:07:59 -05:00
Upgrade eldarion-ajax
This commit is contained in:
6
demo/static/js/eldarion-ajax.min.js
vendored
6
demo/static/js/eldarion-ajax.min.js
vendored
@@ -1,5 +1,7 @@
|
|||||||
/* ====================================================================
|
/* ====================================================================
|
||||||
* eldarion-ajax.min.js v0.7.2
|
* eldarion-ajax.min.js v0.10.0
|
||||||
|
* eldarion-ajax-core v0.8.0
|
||||||
|
* eldarion-ajax-handlers v0.1.1
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
* Copyright (c) 2013, Eldarion, Inc.
|
* Copyright (c) 2013, Eldarion, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
@@ -29,4 +31,4 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
* ==================================================================== */
|
* ==================================================================== */
|
||||||
!function(e){"use strict";var t=function(){};t.prototype.click=function(t){var a=e(this),o=a.attr("href"),r=a.attr("data-method");r||(r="get"),a.trigger("eldarion-ajax:begin",[a]),t.preventDefault(),e.ajax({url:o,type:r,dataType:"json",headers:{"X-Eldarion-Ajax":!0},statusCode:{200:function(e){a.trigger("eldarion-ajax:success",[a,e])},500:function(){a.trigger("eldarion-ajax:error",[a,500])},400:function(){a.trigger("eldarion-ajax:error",[a,400])},404:function(){a.trigger("eldarion-ajax:error",[a,404])}},complete:function(t,o){e(document).trigger("eldarion-ajax:complete",[a,t,o])}})},t.prototype.submit=function(t){var a=e(this),o=a.attr("action"),r=a.attr("method"),n=a.serialize();a.trigger("eldarion-ajax:begin",[a]),t.preventDefault(),e.ajax({url:o,type:r,data:n,dataType:"json",headers:{"X-Eldarion-Ajax":!0},statusCode:{200:function(e){a.trigger("eldarion-ajax:success",[a,e])},500:function(){a.trigger("eldarion-ajax:error",[a,500])},400:function(){a.trigger("eldarion-ajax:error",[a,400])},404:function(){a.trigger("eldarion-ajax:error",[a,404])}},complete:function(t,o){e(document).trigger("eldarion-ajax:complete",[a,t,o])}})},t.prototype.cancel=function(t){var a=e(this),o=a.attr("data-cancel-closest");t.preventDefault(),a.closest(o).remove()},e(function(){e("body").on("click","a.ajax",t.prototype.click),e("body").on("submit","form.ajax",t.prototype.submit),e("body").on("click","a[data-cancel-closest]",t.prototype.cancel)})}(window.jQuery),!function(e){"use strict";var t=function(){};t.prototype.redirect=function(e,t,a){return a.location?(window.location.href=a.location,!1):void 0},t.prototype.replace=function(t,a,o){e(a.data("replace")).replaceWith(o.html)},t.prototype.replaceClosest=function(e,t,a){t.closest(t.data("replace-closest")).replaceWith(a.html)},t.prototype.replaceInner=function(t,a,o){e(a.data("replace-inner")).html(o.html)},t.prototype.replaceClosestInner=function(e,t,a){t.closest(t.data("replace-closest-inner")).html(a.html)},t.prototype.append=function(t,a,o){e(a.data("append")).append(o.html)},t.prototype.prepend=function(t,a,o){e(a.data("prepend")).prepend(o.html)},t.prototype.refresh=function(t,a){e.each(e(a.data("refresh")),function(t,a){e.getJSON(e(a).data("refresh-url"),function(t){e(a).replaceWith(t.html)})})},t.prototype.refreshClosest=function(t,a){e.each(e(a.data("refresh-closest")),function(t,o){e.getJSON(e(o).data("refresh-url"),function(t){a.closest(e(o)).replaceWith(t.html)})})},t.prototype.clear=function(t,a){e(a.data("clear")).html("")},t.prototype.remove=function(t,a){e(a.data("remove")).remove()},t.prototype.clearClosest=function(e,t){t.closest(t.data("clear-closest")).html("")},t.prototype.removeClosest=function(e,t){t.closest(t.data("remove-closest")).remove()},t.prototype.fragments=function(t,a,o){if(o.fragments)for(var r in o.fragments)e(r).replaceWith(o.fragments[r]);if(o["inner-fragments"])for(var n in o["inner-fragments"])e(n).html(o["inner-fragments"][n]);if(o["append-fragments"])for(var c in o["append-fragments"])e(c).append(o["append-fragments"][c]);if(o["prepend-fragments"])for(var s in o["prepend-fragments"])e(s).prepend(o["prepend-fragments"][s])},e(function(){e(document).on("eldarion-ajax:success",t.prototype.redirect),e(document).on("eldarion-ajax:success",t.prototype.fragments),e(document).on("eldarion-ajax:success","[data-replace]",t.prototype.replace),e(document).on("eldarion-ajax:success","[data-replace-closest]",t.prototype.replaceClosest),e(document).on("eldarion-ajax:success","[data-replace-inner]",t.prototype.replaceInner),e(document).on("eldarion-ajax:success","[data-replace-closest-inner]",t.prototype.replaceClosestInner),e(document).on("eldarion-ajax:success","[data-append]",t.prototype.append),e(document).on("eldarion-ajax:success","[data-prepend]",t.prototype.prepend),e(document).on("eldarion-ajax:success","[data-refresh]",t.prototype.refresh),e(document).on("eldarion-ajax:success","[data-refresh-closest]",t.prototype.refreshClosest),e(document).on("eldarion-ajax:success","[data-clear]",t.prototype.clear),e(document).on("eldarion-ajax:success","[data-remove]",t.prototype.remove),e(document).on("eldarion-ajax:success","[data-clear-closest]",t.prototype.clearClosest),e(document).on("eldarion-ajax:success","[data-remove-closest]",t.prototype.removeClosest)})}(window.jQuery);
|
if(document.all&&!window.setTimeout.isPolyfill){var __nativeST__=window.setTimeout;window.setTimeout=function(e,t){var o=Array.prototype.slice.call(arguments,2);return __nativeST__(e instanceof Function?function(){e.apply(null,o)}:e,t)},window.setTimeout.isPolyfill=!0}if(document.all&&!window.setInterval.isPolyfill){var __nativeSI__=window.setInterval;window.setInterval=function(e,t){var o=Array.prototype.slice.call(arguments,2);return __nativeSI__(e instanceof Function?function(){e.apply(null,o)}:e,t)},window.setInterval.isPolyfill=!0}!function(e){"use strict";var t=function(){};t.prototype._ajax=function(t,o,a,n){t.trigger("eldarion-ajax:begin",[t]),e.ajax({url:o,type:a,dataType:"json",data:n,headers:{"X-Eldarion-Ajax":!0},statusCode:{200:function(e){e||(e={}),t.trigger("eldarion-ajax:success",[t,e])},500:function(){t.trigger("eldarion-ajax:error",[t,500])},400:function(){t.trigger("eldarion-ajax:error",[t,400])},404:function(){t.trigger("eldarion-ajax:error",[t,404])}},complete:function(o,a){e(document).trigger("eldarion-ajax:complete",[t,o,a])}})},t.prototype.click=function(o){var a=e(this),n=a.attr("href"),r=a.data("method");r||(r="get"),o.preventDefault(),t.prototype._ajax(a,n,r,null)},t.prototype.submit=function(o){var a=e(this),n=a.attr("action"),r=a.attr("method"),c=a.serialize();o.preventDefault(),t.prototype._ajax(a,n,r,c)},t.prototype.cancel=function(t){var o=e(this),a=o.attr("data-cancel-closest");t.preventDefault(),o.closest(a).remove()},t.prototype.timeout=function(o,a){var n=e(a),r=n.data("timeout"),c=n.data("url"),l=n.data("method");l||(l="get"),window.setTimeout(t.prototype._ajax,r,n,c,l,null)},t.prototype.interval=function(o,a){var n=e(a),r=n.data("interval"),c=n.data("url"),l=n.data("method");l||(l="get"),window.setInterval(t.prototype._ajax,r,n,c,l,null)},e(function(){e("body").on("click","a.ajax",t.prototype.click),e("body").on("submit","form.ajax",t.prototype.submit),e("body").on("click","a[data-cancel-closest]",t.prototype.cancel),e("[data-timeout]").each(t.prototype.timeout),e("[data-interval]").each(t.prototype.interval)})}(window.jQuery),function(e){"use strict";var t=function(){};t.prototype.redirect=function(e,t,o){return o.location?(window.location.href=o.location,!1):void 0},t.prototype.replace=function(t,o,a){e(o.data("replace")).replaceWith(a.html)},t.prototype.replaceClosest=function(e,t,o){t.closest(t.data("replace-closest")).replaceWith(o.html)},t.prototype.replaceInner=function(t,o,a){e(o.data("replace-inner")).html(a.html)},t.prototype.replaceClosestInner=function(e,t,o){t.closest(t.data("replace-closest-inner")).html(o.html)},t.prototype.append=function(t,o,a){e(o.data("append")).append(a.html)},t.prototype.prepend=function(t,o,a){e(o.data("prepend")).prepend(a.html)},t.prototype.refresh=function(t,o){e.each(e(o.data("refresh")),function(t,o){e.getJSON(e(o).data("refresh-url"),function(t){e(o).replaceWith(t.html)})})},t.prototype.refreshClosest=function(t,o){e.each(e(o.data("refresh-closest")),function(t,a){e.getJSON(e(a).data("refresh-url"),function(t){o.closest(e(a)).replaceWith(t.html)})})},t.prototype.clear=function(t,o){e(o.data("clear")).html("")},t.prototype.remove=function(t,o){e(o.data("remove")).remove()},t.prototype.clearClosest=function(e,t){t.closest(t.data("clear-closest")).html("")},t.prototype.removeClosest=function(e,t){t.closest(t.data("remove-closest")).remove()},t.prototype.fragments=function(t,o,a){a.fragments&&e.each(a.fragments,function(t,o){e(t).replaceWith(o)}),a["inner-fragments"]&&e.each(a["inner-fragments"],function(t,o){e(t).html(o)}),a["append-fragments"]&&e.each(a["append-fragments"],function(t,o){e(t).append(o)}),a["prepend-fragments"]&&e.each(a["prepend-fragments"],function(t,o){e(t).prepend(o)})},e(function(){e(document).on("eldarion-ajax:success",t.prototype.redirect),e(document).on("eldarion-ajax:success",t.prototype.fragments),e(document).on("eldarion-ajax:success","[data-replace]",t.prototype.replace),e(document).on("eldarion-ajax:success","[data-replace-closest]",t.prototype.replaceClosest),e(document).on("eldarion-ajax:success","[data-replace-inner]",t.prototype.replaceInner),e(document).on("eldarion-ajax:success","[data-replace-closest-inner]",t.prototype.replaceClosestInner),e(document).on("eldarion-ajax:success","[data-append]",t.prototype.append),e(document).on("eldarion-ajax:success","[data-prepend]",t.prototype.prepend),e(document).on("eldarion-ajax:success","[data-refresh]",t.prototype.refresh),e(document).on("eldarion-ajax:success","[data-refresh-closest]",t.prototype.refreshClosest),e(document).on("eldarion-ajax:success","[data-clear]",t.prototype.clear),e(document).on("eldarion-ajax:success","[data-remove]",t.prototype.remove),e(document).on("eldarion-ajax:success","[data-clear-closest]",t.prototype.clearClosest),e(document).on("eldarion-ajax:success","[data-remove-closest]",t.prototype.removeClosest)})}(window.jQuery);
|
||||||
Reference in New Issue
Block a user