Skip to content

Commit fdbcabb

Browse files
committed
JS: Move all JavaScript files to new folder
- Add jQuery 2.1.4 to repository - Add jQuery Flot Resize plugin
1 parent 50ee2b5 commit fdbcabb

8 files changed

+69
-4
lines changed

graph.html

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<title>%l10n_title_graph%</title>
22

33
<head>
4-
<script language="javascript" type="text/javascript" src="jquery.flot.min.js"></script>
5-
<script language="javascript" type="text/javascript" src="jquery.flot.categories.min.js"></script>
4+
<script language="javascript" type="text/javascript" src="js/jquery.flot.min.js"></script>
5+
<script language="javascript" type="text/javascript" src="js/jquery.flot.categories.min.js"></script>
6+
<script language="javascript" type="text/javascript" src="js/jquery.flot.resize.js"></script>
67
<script type="text/javascript">
78
function showLoads()
89
{

index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<style type="text/css">
88
body { margin: 0px }
99
</style>
10-
<script src="//code.jquery.com/jquery-2.1.4.min.js"></script>
10+
<script src="js/jquery-2.1.4.min.js"></script>
1111
<script type="text/javascript">
1212
function isMobile()
1313
{
File renamed without changes.

js/jquery-2.1.4.min.js

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
File renamed without changes.
File renamed without changes.

js/jquery.flot.resize.js

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
Flot plugin for automatically redrawing plots when the placeholder
3+
size changes, e.g. on window resizes.
4+
5+
It works by listening for changes on the placeholder div (through the
6+
jQuery resize event plugin) - if the size changes, it will redraw the
7+
plot.
8+
9+
There are no options. If you need to disable the plugin for some
10+
plots, you can just fix the size of their placeholders.
11+
*/
12+
13+
14+
/* Inline dependency:
15+
* jQuery resize event - v1.1 - 3/14/2010
16+
* http://benalman.com/projects/jquery-resize-plugin/
17+
*
18+
* Copyright (c) 2010 "Cowboy" Ben Alman
19+
* Dual licensed under the MIT and GPL licenses.
20+
* http://benalman.com/about/license/
21+
*/
22+
(function($,h,c){var a=$([]),e=$.resize=$.extend($.resize,{}),i,k="setTimeout",j="resize",d=j+"-special-event",b="delay",f="throttleWindow";e[b]=250;e[f]=true;$.event.special[j]={setup:function(){if(!e[f]&&this[k]){return false}var l=$(this);a=a.add(l);$.data(this,d,{w:l.width(),h:l.height()});if(a.length===1){g()}},teardown:function(){if(!e[f]&&this[k]){return false}var l=$(this);a=a.not(l);l.removeData(d);if(!a.length){clearTimeout(i)}},add:function(l){if(!e[f]&&this[k]){return false}var n;function m(s,o,p){var q=$(this),r=$.data(this,d);r.w=o!==c?o:q.width();r.h=p!==c?p:q.height();n.apply(this,arguments)}if($.isFunction(l)){n=l;return m}else{n=l.handler;l.handler=m}}};function g(){i=h[k](function(){a.each(function(){var n=$(this),m=n.width(),l=n.height(),o=$.data(this,d);if(m!==o.w||l!==o.h){n.trigger(j,[o.w=m,o.h=l])}});g()},e[b])}})(jQuery,this);
23+
24+
25+
(function ($) {
26+
var options = { }; // no options
27+
28+
function init(plot) {
29+
function onResize() {
30+
var placeholder = plot.getPlaceholder();
31+
32+
// somebody might have hidden us and we can't plot
33+
// when we don't have the dimensions
34+
if (placeholder.width() == 0 || placeholder.height() == 0)
35+
return;
36+
37+
plot.resize();
38+
plot.setupGrid();
39+
plot.draw();
40+
}
41+
42+
function bindEvents(plot, eventHolder) {
43+
plot.getPlaceholder().resize(onResize);
44+
}
45+
46+
function shutdown(plot, eventHolder) {
47+
plot.getPlaceholder().unbind("resize", onResize);
48+
}
49+
50+
plot.hooks.bindEvents.push(bindEvents);
51+
plot.hooks.shutdown.push(shutdown);
52+
}
53+
54+
$.plot.plugins.push({
55+
init: init,
56+
options: options,
57+
name: 'resize',
58+
version: '1.0'
59+
});
60+
})(jQuery);

map.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<head>
44
<script src="//api-maps.yandex.ru/2.1/?lang=ru-RU" type="text/javascript"></script>
5-
<script src="FileSaver.min.js" type="text/javascript"></script>
5+
<script src="js/FileSaver.min.js" type="text/javascript"></script>
66
<script type="text/javascript">
77
function initmap()
88
{

0 commit comments

Comments
 (0)