OLD | NEW |
1 (function(n,p,u){var w=n([]),s=n.resize=n.extend(n.resize,{}),o,l="setTimeout",m
="resize",t=m+"-special-event",v="delay",r="throttleWindow";s[v]=250;s[r]=true;n
.event.special[m]={setup:function(){if(!s[r]&&this[l]){return false}var a=n(this
);w=w.add(a);n.data(this,t,{w:a.width(),h:a.height()});if(w.length===1){q()}},te
ardown:function(){if(!s[r]&&this[l]){return false}var a=n(this);w=w.not(a);a.rem
oveData(t);if(!w.length){clearTimeout(o)}},add:function(b){if(!s[r]&&this[l]){re
turn false}var c;function a(d,h,g){var f=n(this),e=n.data(this,t);e.w=h!==u?h:f.
width();e.h=g!==u?g:f.height();c.apply(this,arguments)}if(n.isFunction(b)){c=b;r
eturn a}else{c=b.handler;b.handler=a}}};function q(){o=p[l](function(){w.each(fu
nction(){var d=n(this),a=d.width(),b=d.height(),c=n.data(this,t);if(a!==c.w||b!=
=c.h){d.trigger(m,[c.w=a,c.h=b])}});q()},s[v])}})(jQuery,this);(function(b){var
a={};function c(f){function e(){var h=f.getPlaceholder();if(h.width()==0||h.heig
ht()==0){return}f.resize();f.setupGrid();f.draw()}function g(i,h){i.getPlacehold
er().resize(e)}function d(i,h){i.getPlaceholder().unbind("resize",e)}f.hooks.bin
dEvents.push(g);f.hooks.shutdown.push(d)}b.plot.plugins.push({init:c,options:a,n
ame:"resize",version:"1.0"})})(jQuery); | 1 /* Flot plugin for automatically redrawing plots as the placeholder resizes. |
| 2 |
| 3 Copyright (c) 2007-2013 IOLA and Ole Laursen. |
| 4 Licensed under the MIT license. |
| 5 |
| 6 It works by listening for changes on the placeholder div (through the jQuery |
| 7 resize event plugin) - if the size changes, it will redraw the plot. |
| 8 |
| 9 There are no options. If you need to disable the plugin for some plots, you |
| 10 can just fix the size of their placeholders. |
| 11 |
| 12 *//* Inline dependency: |
| 13 * jQuery resize event - v1.1 - 3/14/2010 |
| 14 * http://benalman.com/projects/jquery-resize-plugin/ |
| 15 * |
| 16 * Copyright (c) 2010 "Cowboy" Ben Alman |
| 17 * Dual licensed under the MIT and GPL licenses. |
| 18 * http://benalman.com/about/license/ |
| 19 */(function(e,t,n){function c(){s=t[o](function(){r.each(function(){var t=e(thi
s),n=t.width(),r=t.height(),i=e.data(this,a);(n!==i.w||r!==i.h)&&t.trigger(u,[i.
w=n,i.h=r])}),c()},i[f])}var r=e([]),i=e.resize=e.extend(e.resize,{}),s,o="setTi
meout",u="resize",a=u+"-special-event",f="delay",l="throttleWindow";i[f]=250,i[l
]=!0,e.event.special[u]={setup:function(){if(!i[l]&&this[o])return!1;var t=e(thi
s);r=r.add(t),e.data(this,a,{w:t.width(),h:t.height()}),r.length===1&&c()},teard
own:function(){if(!i[l]&&this[o])return!1;var t=e(this);r=r.not(t),t.removeData(
a),r.length||clearTimeout(s)},add:function(t){function s(t,i,s){var o=e(this),u=
e.data(this,a);u.w=i!==n?i:o.width(),u.h=s!==n?s:o.height(),r.apply(this,argumen
ts)}if(!i[l]&&this[o])return!1;var r;if(e.isFunction(t))return r=t,s;r=t.handler
,t.handler=s}}})(jQuery,this),function(e){function n(e){function t(){var t=e.get
Placeholder();if(t.width()==0||t.height()==0)return;e.resize(),e.setupGrid(),e.d
raw()}function n(e,n){e.getPlaceholder().resize(t)}function r(e,n){e.getPlacehol
der().unbind("resize",t)}e.hooks.bindEvents.push(n),e.hooks.shutdown.push(r)}var
t={};e.plot.plugins.push({init:n,options:t,name:"resize",version:"1.0"})}(jQuer
y); |
OLD | NEW |