devoops-rails 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +9 -0
- data/LICENSE.txt +22 -0
- data/README.md +69 -0
- data/Rakefile +2 -0
- data/app/assets/images/devoops-rails/8962691008_7f489395c9_m.jpg +0 -0
- data/app/assets/images/devoops-rails/8985207189_01ea27882d_m.jpg +0 -0
- data/app/assets/images/devoops-rails/9036958611_fa1bb7f827_m.jpg +0 -0
- data/app/assets/images/devoops-rails/9041440555_2175b32078_m.jpg +0 -0
- data/app/assets/images/devoops-rails/avatar.jpg +0 -0
- data/app/assets/images/devoops-rails/chevron-left.png +0 -0
- data/app/assets/images/devoops-rails/chevron-right.png +0 -0
- data/app/assets/images/devoops-rails/devoops_getdata.gif +0 -0
- data/app/assets/images/devoops-rails/devoops_pattern_b10.png +0 -0
- data/app/assets/images/devoops-rails/logo-200.png +0 -0
- data/app/assets/images/devoops-rails/logo.png +0 -0
- data/app/assets/images/devoops-rails/sort-asc.png +0 -0
- data/app/assets/images/devoops-rails/sort-desc.png +0 -0
- data/app/assets/images/devoops-rails/sort.png +0 -0
- data/app/assets/images/devoops-rails/times.png +0 -0
- data/app/assets/images/devoops-rails/ui-accordion-down.png +0 -0
- data/app/assets/images/devoops-rails/ui-accordion-right.png +0 -0
- data/app/assets/images/devoops-rails/ui-left.png +0 -0
- data/app/assets/images/devoops-rails/ui-right.png +0 -0
- data/app/assets/javascripts/devoops-rails/devoops.js +2198 -0
- data/app/assets/stylesheets/devoops-rails/devoops.css.erb +2360 -0
- data/lib/devoops-rails.rb +1 -0
- data/lib/devoops/rails.rb +2 -0
- data/lib/devoops/rails/engine.rb +9 -0
- data/lib/devoops/rails/version.rb +5 -0
- metadata +31 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7c4ccb88d82f3414f4c465c568143bfaf6e2b3c
|
4
|
+
data.tar.gz: ec266a440127c6de40fccf54dfcd3a0ce4904b0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c30119650448669172e439745920ec0393017db2ead4c3e95309d9c5ff48901ad9f95a6d244ddc57ecd683ee9ff31f699b9ea515b19f09e403b60ab02aaadb45
|
7
|
+
data.tar.gz: 7f846c4e17f3c57438cc63c79d8a6236433d45389b9d70d6d74504ba0b51e039fc50bd4e70954e85ea505364afcc0982fce02a5833c00f8252e09a807e87b308
|
data/Gemfile
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
source 'https://rails-assets.org'
|
3
|
+
|
4
|
+
# Specify your gem's dependencies in devoops-rails.gemspec
|
5
|
+
gem 'rails-assets-bootstrap', '3.1.0'
|
6
|
+
gem 'font-awesome-rails', '4.0.3.2'
|
7
|
+
gem 'rails-assets-jquery', '2.1.0'
|
8
|
+
gem 'rails-assets-jquery-ui', '1.10.4'
|
9
|
+
gemspec
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Dener W P do Carmo
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
# Devoops::Rails
|
2
|
+
|
3
|
+
Made for use [devoops template (bootstrap v3)](https://github.com/devoopsme/devoops)
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'devoops-rails'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install devoops-rails
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
Include this source in the Gemfile to use rails-assets gems:
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
source 'https://rails-assets.org'
|
25
|
+
```
|
26
|
+
|
27
|
+
And include the dependencies in Gemfile:
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
gem 'rails-assets-bootstrap', '3.1.0'
|
31
|
+
gem 'rails-bootstrap-helpers'
|
32
|
+
gem 'bootstrap-datepicker-rails', '~> 1.3.0.1'
|
33
|
+
gem "font-awesome-rails"
|
34
|
+
gem 'rails-assets-jquery', '2.1.0'
|
35
|
+
gem 'rails-assets-jquery-ui', '1.10.4'
|
36
|
+
```
|
37
|
+
|
38
|
+
Add the following to your application.js:
|
39
|
+
|
40
|
+
```ruby
|
41
|
+
//= require jquery
|
42
|
+
//= require jquery-ui
|
43
|
+
//= require turbolinks
|
44
|
+
//= require bootstrap
|
45
|
+
//= require devoops-rails/devoops
|
46
|
+
//= require_tree .
|
47
|
+
```
|
48
|
+
|
49
|
+
Also add the following to your application.css:
|
50
|
+
|
51
|
+
```ruby
|
52
|
+
*= require_self
|
53
|
+
*= require_tree .
|
54
|
+
*= require bootstrap
|
55
|
+
*= require jquery-ui
|
56
|
+
*= require font-awesome
|
57
|
+
*= require devoops-rails/devoops
|
58
|
+
*/
|
59
|
+
```
|
60
|
+
Just using basic components. Fullcalendar, tinymce, xcharts, fineuploader, fancybox and others plugins are not implemented yet.
|
61
|
+
To test devoops layout, use the same code in the index.html from root path of devoops source.
|
62
|
+
|
63
|
+
## Contributing
|
64
|
+
|
65
|
+
1. Fork it ( https://github.com/denerblack/devoops-rails/fork )
|
66
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
67
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
68
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
69
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,2198 @@
|
|
1
|
+
//
|
2
|
+
// Main script of DevOOPS v1.0 Bootstrap Theme
|
3
|
+
//
|
4
|
+
"use strict";
|
5
|
+
/*-------------------------------------------
|
6
|
+
Main scripts used by theme
|
7
|
+
---------------------------------------------*/
|
8
|
+
//
|
9
|
+
// Function for load content from url and put in $('.ajax-content') block
|
10
|
+
//
|
11
|
+
function LoadAjaxContent(url){
|
12
|
+
$('.preloader').show();
|
13
|
+
$.ajax({
|
14
|
+
mimeType: 'text/html; charset=utf-8', // ! Need set mimeType only when run from local file
|
15
|
+
url: url,
|
16
|
+
type: 'GET',
|
17
|
+
success: function(data) {
|
18
|
+
$('#ajax-content').html(data);
|
19
|
+
$('.preloader').hide();
|
20
|
+
},
|
21
|
+
error: function (jqXHR, textStatus, errorThrown) {
|
22
|
+
alert(errorThrown);
|
23
|
+
},
|
24
|
+
dataType: "html",
|
25
|
+
async: false
|
26
|
+
});
|
27
|
+
}
|
28
|
+
//
|
29
|
+
// Function maked all .box selector is draggable, to disable for concrete element add class .no-drop
|
30
|
+
//
|
31
|
+
function WinMove(){
|
32
|
+
$( "div.box").not('.no-drop')
|
33
|
+
.draggable({
|
34
|
+
revert: true,
|
35
|
+
zIndex: 2000,
|
36
|
+
cursor: "crosshair",
|
37
|
+
handle: '.box-name',
|
38
|
+
opacity: 0.8
|
39
|
+
})
|
40
|
+
.droppable({
|
41
|
+
tolerance: 'pointer',
|
42
|
+
drop: function( event, ui ) {
|
43
|
+
var draggable = ui.draggable;
|
44
|
+
var droppable = $(this);
|
45
|
+
var dragPos = draggable.position();
|
46
|
+
var dropPos = droppable.position();
|
47
|
+
draggable.swap(droppable);
|
48
|
+
setTimeout(function() {
|
49
|
+
var dropmap = droppable.find('[id^=map-]');
|
50
|
+
var dragmap = draggable.find('[id^=map-]');
|
51
|
+
if (dragmap.length > 0 || dropmap.length > 0){
|
52
|
+
dragmap.resize();
|
53
|
+
dropmap.resize();
|
54
|
+
}
|
55
|
+
else {
|
56
|
+
draggable.resize();
|
57
|
+
droppable.resize();
|
58
|
+
}
|
59
|
+
}, 50);
|
60
|
+
setTimeout(function() {
|
61
|
+
draggable.find('[id^=map-]').resize();
|
62
|
+
droppable.find('[id^=map-]').resize();
|
63
|
+
}, 250);
|
64
|
+
}
|
65
|
+
});
|
66
|
+
}
|
67
|
+
//
|
68
|
+
// Swap 2 elements on page. Used by WinMove function
|
69
|
+
//
|
70
|
+
jQuery.fn.swap = function(b){
|
71
|
+
b = jQuery(b)[0];
|
72
|
+
var a = this[0];
|
73
|
+
var t = a.parentNode.insertBefore(document.createTextNode(''), a);
|
74
|
+
b.parentNode.insertBefore(a, b);
|
75
|
+
t.parentNode.insertBefore(b, t);
|
76
|
+
t.parentNode.removeChild(t);
|
77
|
+
return this;
|
78
|
+
};
|
79
|
+
//
|
80
|
+
// Screensaver function
|
81
|
+
// used on locked screen, and write content to element with id - canvas
|
82
|
+
//
|
83
|
+
function ScreenSaver(){
|
84
|
+
var canvas = document.getElementById("canvas");
|
85
|
+
var ctx = canvas.getContext("2d");
|
86
|
+
// Size of canvas set to fullscreen of browser
|
87
|
+
var W = window.innerWidth;
|
88
|
+
var H = window.innerHeight;
|
89
|
+
canvas.width = W;
|
90
|
+
canvas.height = H;
|
91
|
+
// Create array of particles for screensaver
|
92
|
+
var particles = [];
|
93
|
+
for (var i = 0; i < 25; i++) {
|
94
|
+
particles.push(new Particle());
|
95
|
+
}
|
96
|
+
function Particle(){
|
97
|
+
// location on the canvas
|
98
|
+
this.location = {x: Math.random()*W, y: Math.random()*H};
|
99
|
+
// radius - lets make this 0
|
100
|
+
this.radius = 0;
|
101
|
+
// speed
|
102
|
+
this.speed = 3;
|
103
|
+
// random angle in degrees range = 0 to 360
|
104
|
+
this.angle = Math.random()*360;
|
105
|
+
// colors
|
106
|
+
var r = Math.round(Math.random()*255);
|
107
|
+
var g = Math.round(Math.random()*255);
|
108
|
+
var b = Math.round(Math.random()*255);
|
109
|
+
var a = Math.random();
|
110
|
+
this.rgba = "rgba("+r+", "+g+", "+b+", "+a+")";
|
111
|
+
}
|
112
|
+
// Draw the particles
|
113
|
+
function draw() {
|
114
|
+
// re-paint the BG
|
115
|
+
// Lets fill the canvas black
|
116
|
+
// reduce opacity of bg fill.
|
117
|
+
// blending time
|
118
|
+
ctx.globalCompositeOperation = "source-over";
|
119
|
+
ctx.fillStyle = "rgba(0, 0, 0, 0.02)";
|
120
|
+
ctx.fillRect(0, 0, W, H);
|
121
|
+
ctx.globalCompositeOperation = "lighter";
|
122
|
+
for(var i = 0; i < particles.length; i++){
|
123
|
+
var p = particles[i];
|
124
|
+
ctx.fillStyle = "white";
|
125
|
+
ctx.fillRect(p.location.x, p.location.y, p.radius, p.radius);
|
126
|
+
// Lets move the particles
|
127
|
+
// So we basically created a set of particles moving in random direction
|
128
|
+
// at the same speed
|
129
|
+
// Time to add ribbon effect
|
130
|
+
for(var n = 0; n < particles.length; n++){
|
131
|
+
var p2 = particles[n];
|
132
|
+
// calculating distance of particle with all other particles
|
133
|
+
var yd = p2.location.y - p.location.y;
|
134
|
+
var xd = p2.location.x - p.location.x;
|
135
|
+
var distance = Math.sqrt(xd*xd + yd*yd);
|
136
|
+
// draw a line between both particles if they are in 200px range
|
137
|
+
if(distance < 200){
|
138
|
+
ctx.beginPath();
|
139
|
+
ctx.lineWidth = 1;
|
140
|
+
ctx.moveTo(p.location.x, p.location.y);
|
141
|
+
ctx.lineTo(p2.location.x, p2.location.y);
|
142
|
+
ctx.strokeStyle = p.rgba;
|
143
|
+
ctx.stroke();
|
144
|
+
//The ribbons appear now.
|
145
|
+
}
|
146
|
+
}
|
147
|
+
// We are using simple vectors here
|
148
|
+
// New x = old x + speed * cos(angle)
|
149
|
+
p.location.x = p.location.x + p.speed*Math.cos(p.angle*Math.PI/180);
|
150
|
+
// New y = old y + speed * sin(angle)
|
151
|
+
p.location.y = p.location.y + p.speed*Math.sin(p.angle*Math.PI/180);
|
152
|
+
// You can read about vectors here:
|
153
|
+
// http://physics.about.com/od/mathematics/a/VectorMath.htm
|
154
|
+
if(p.location.x < 0) p.location.x = W;
|
155
|
+
if(p.location.x > W) p.location.x = 0;
|
156
|
+
if(p.location.y < 0) p.location.y = H;
|
157
|
+
if(p.location.y > H) p.location.y = 0;
|
158
|
+
}
|
159
|
+
}
|
160
|
+
setInterval(draw, 30);
|
161
|
+
}
|
162
|
+
//
|
163
|
+
// Helper for draw Google Chart
|
164
|
+
//
|
165
|
+
function drawGoogleChart(chart_data, chart_options, element, chart_type) {
|
166
|
+
// Function for visualize Google Chart
|
167
|
+
var data = google.visualization.arrayToDataTable(chart_data);
|
168
|
+
var chart = new chart_type(document.getElementById(element));
|
169
|
+
chart.draw(data, chart_options);
|
170
|
+
}
|
171
|
+
//
|
172
|
+
// Function for Draw Knob Charts
|
173
|
+
//
|
174
|
+
function DrawKnob(elem){
|
175
|
+
elem.knob({
|
176
|
+
change : function (value) {
|
177
|
+
//console.log("change : " + value);
|
178
|
+
},
|
179
|
+
release : function (value) {
|
180
|
+
//console.log(this.$.attr('value'));
|
181
|
+
console.log("release : " + value);
|
182
|
+
},
|
183
|
+
cancel : function () {
|
184
|
+
console.log("cancel : ", this);
|
185
|
+
},
|
186
|
+
draw : function () {
|
187
|
+
// "tron" case
|
188
|
+
if(this.$.data('skin') == 'tron') {
|
189
|
+
var a = this.angle(this.cv); // Angle
|
190
|
+
var sa = this.startAngle; // Previous start angle
|
191
|
+
var sat = this.startAngle; // Start angle
|
192
|
+
var ea; // Previous end angle
|
193
|
+
var eat = sat + a; // End angle
|
194
|
+
var r = 1;
|
195
|
+
this.g.lineWidth = this.lineWidth;
|
196
|
+
this.o.cursor
|
197
|
+
&& (sat = eat - 0.3)
|
198
|
+
&& (eat = eat + 0.3);
|
199
|
+
if (this.o.displayPrevious) {
|
200
|
+
ea = this.startAngle + this.angle(this.v);
|
201
|
+
this.o.cursor
|
202
|
+
&& (sa = ea - 0.3)
|
203
|
+
&& (ea = ea + 0.3);
|
204
|
+
this.g.beginPath();
|
205
|
+
this.g.strokeStyle = this.pColor;
|
206
|
+
this.g.arc(this.xy, this.xy, this.radius - this.lineWidth, sa, ea, false);
|
207
|
+
this.g.stroke();
|
208
|
+
}
|
209
|
+
this.g.beginPath();
|
210
|
+
this.g.strokeStyle = r ? this.o.fgColor : this.fgColor ;
|
211
|
+
this.g.arc(this.xy, this.xy, this.radius - this.lineWidth, sat, eat, false);
|
212
|
+
this.g.stroke();
|
213
|
+
this.g.lineWidth = 2;
|
214
|
+
this.g.beginPath();
|
215
|
+
this.g.strokeStyle = this.o.fgColor;
|
216
|
+
this.g.arc( this.xy, this.xy, this.radius - this.lineWidth + 1 + this.lineWidth * 2 / 3, 0, 2 * Math.PI, false);
|
217
|
+
this.g.stroke();
|
218
|
+
return false;
|
219
|
+
}
|
220
|
+
}
|
221
|
+
});
|
222
|
+
// Example of infinite knob, iPod click wheel
|
223
|
+
var v;
|
224
|
+
var up = 0;
|
225
|
+
var down=0;
|
226
|
+
var i=0;
|
227
|
+
var $idir = $("div.idir");
|
228
|
+
var $ival = $("div.ival");
|
229
|
+
var incr = function() { i++; $idir.show().html("+").fadeOut(); $ival.html(i); }
|
230
|
+
var decr = function() { i--; $idir.show().html("-").fadeOut(); $ival.html(i); };
|
231
|
+
$("input.infinite").knob(
|
232
|
+
{
|
233
|
+
min : 0,
|
234
|
+
max : 20,
|
235
|
+
stopper : false,
|
236
|
+
change : function () {
|
237
|
+
if(v > this.cv){
|
238
|
+
if(up){
|
239
|
+
decr();
|
240
|
+
up=0;
|
241
|
+
} else {
|
242
|
+
up=1;down=0;
|
243
|
+
}
|
244
|
+
} else {
|
245
|
+
if(v < this.cv){
|
246
|
+
if(down){
|
247
|
+
incr();
|
248
|
+
down=0;
|
249
|
+
} else {
|
250
|
+
down=1;up=0;
|
251
|
+
}
|
252
|
+
}
|
253
|
+
}
|
254
|
+
v = this.cv;
|
255
|
+
}
|
256
|
+
});
|
257
|
+
}
|
258
|
+
//
|
259
|
+
// Create OpenLayers map with required options and return map as object
|
260
|
+
//
|
261
|
+
function drawMap(lon, lat, elem, layers) {
|
262
|
+
var LayersArray = [];
|
263
|
+
// Map initialization
|
264
|
+
var map = new OpenLayers.Map(elem);
|
265
|
+
// Add layers on map
|
266
|
+
map.addLayers(layers);
|
267
|
+
// WGS 1984 projection
|
268
|
+
var epsg4326 = new OpenLayers.Projection("EPSG:4326");
|
269
|
+
//The map projection (Spherical Mercator)
|
270
|
+
var projectTo = map.getProjectionObject();
|
271
|
+
// Max zoom = 17
|
272
|
+
var zoom=10;
|
273
|
+
map.zoomToMaxExtent();
|
274
|
+
// Set longitude/latitude
|
275
|
+
var lonlat = new OpenLayers.LonLat(lon, lat);
|
276
|
+
map.setCenter(lonlat.transform(epsg4326, projectTo), zoom);
|
277
|
+
var layerGuest = new OpenLayers.Layer.Vector("You are here");
|
278
|
+
// Define markers as "features" of the vector layer:
|
279
|
+
var guestMarker = new OpenLayers.Feature.Vector(
|
280
|
+
new OpenLayers.Geometry.Point(lon, lat).transform(epsg4326, projectTo)
|
281
|
+
);
|
282
|
+
layerGuest.addFeatures(guestMarker);
|
283
|
+
LayersArray.push(layerGuest);
|
284
|
+
map.addLayers(LayersArray);
|
285
|
+
// If map layers > 1 then show checker
|
286
|
+
if (layers.length > 1){
|
287
|
+
map.addControl(new OpenLayers.Control.LayerSwitcher({'ascending':true}));
|
288
|
+
}
|
289
|
+
// Link to current position
|
290
|
+
map.addControl(new OpenLayers.Control.Permalink());
|
291
|
+
// Show current mouse coords
|
292
|
+
map.addControl(new OpenLayers.Control.MousePosition({ displayProjection: epsg4326 }));
|
293
|
+
return map
|
294
|
+
}
|
295
|
+
//
|
296
|
+
// Function for create 2 dates in human-readable format (with leading zero)
|
297
|
+
//
|
298
|
+
function PrettyDates(){
|
299
|
+
var currDate = new Date();
|
300
|
+
var year = currDate.getFullYear();
|
301
|
+
var month = currDate.getMonth() + 1;
|
302
|
+
var startmonth = 1;
|
303
|
+
if (month > 3){
|
304
|
+
startmonth = month -2;
|
305
|
+
}
|
306
|
+
if (startmonth <=9){
|
307
|
+
startmonth = '0'+startmonth;
|
308
|
+
}
|
309
|
+
if (month <= 9) {
|
310
|
+
month = '0'+month;
|
311
|
+
}
|
312
|
+
var day= currDate.getDate();
|
313
|
+
if (day <= 9) {
|
314
|
+
day = '0'+day;
|
315
|
+
}
|
316
|
+
var startdate = year +'-'+ startmonth +'-01';
|
317
|
+
var enddate = year +'-'+ month +'-'+ day;
|
318
|
+
return [startdate, enddate];
|
319
|
+
}
|
320
|
+
//
|
321
|
+
// Function set min-height of window (required for this theme)
|
322
|
+
//
|
323
|
+
function SetMinBlockHeight(elem){
|
324
|
+
elem.css('min-height', window.innerHeight - 49)
|
325
|
+
}
|
326
|
+
//
|
327
|
+
// Helper for correct size of Messages page
|
328
|
+
//
|
329
|
+
function MessagesMenuWidth(){
|
330
|
+
var W = window.innerWidth;
|
331
|
+
var W_menu = $('#sidebar-left').outerWidth();
|
332
|
+
var w_messages = (W-W_menu)*16.666666666666664/100;
|
333
|
+
$('#messages-menu').width(w_messages);
|
334
|
+
}
|
335
|
+
//
|
336
|
+
// Function for change panels of Dashboard
|
337
|
+
//
|
338
|
+
function DashboardTabChecker(){
|
339
|
+
$('#content').on('click', 'a.tab-link', function(e){
|
340
|
+
e.preventDefault();
|
341
|
+
$('div#dashboard_tabs').find('div[id^=dashboard]').each(function(){
|
342
|
+
$(this).css('visibility', 'hidden').css('position', 'absolute');
|
343
|
+
});
|
344
|
+
var attr = $(this).attr('id');
|
345
|
+
$('#'+'dashboard-'+attr).css('visibility', 'visible').css('position', 'relative');
|
346
|
+
$(this).closest('.nav').find('li').removeClass('active');
|
347
|
+
$(this).closest('li').addClass('active');
|
348
|
+
});
|
349
|
+
}
|
350
|
+
//
|
351
|
+
// Helper for run TinyMCE editor with textarea's
|
352
|
+
//
|
353
|
+
function TinyMCEStart(elem, mode){
|
354
|
+
var plugins = [];
|
355
|
+
if (mode == 'extreme'){
|
356
|
+
plugins = [ "advlist anchor autolink autoresize autosave bbcode charmap code contextmenu directionality ",
|
357
|
+
"emoticons fullpage fullscreen hr image insertdatetime layer legacyoutput",
|
358
|
+
"link lists media nonbreaking noneditable pagebreak paste preview print save searchreplace",
|
359
|
+
"tabfocus table template textcolor visualblocks visualchars wordcount"]
|
360
|
+
}
|
361
|
+
tinymce.init({selector: elem,
|
362
|
+
theme: "modern",
|
363
|
+
plugins: plugins,
|
364
|
+
//content_css: "css/style.css",
|
365
|
+
toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | print preview media fullpage | forecolor backcolor emoticons",
|
366
|
+
style_formats: [
|
367
|
+
{title: 'Header 2', block: 'h2', classes: 'page-header'},
|
368
|
+
{title: 'Header 3', block: 'h3', classes: 'page-header'},
|
369
|
+
{title: 'Header 4', block: 'h4', classes: 'page-header'},
|
370
|
+
{title: 'Header 5', block: 'h5', classes: 'page-header'},
|
371
|
+
{title: 'Header 6', block: 'h6', classes: 'page-header'},
|
372
|
+
{title: 'Bold text', inline: 'b'},
|
373
|
+
{title: 'Red text', inline: 'span', styles: {color: '#ff0000'}},
|
374
|
+
{title: 'Red header', block: 'h1', styles: {color: '#ff0000'}},
|
375
|
+
{title: 'Example 1', inline: 'span', classes: 'example1'},
|
376
|
+
{title: 'Example 2', inline: 'span', classes: 'example2'},
|
377
|
+
{title: 'Table styles'},
|
378
|
+
{title: 'Table row 1', selector: 'tr', classes: 'tablerow1'}
|
379
|
+
]
|
380
|
+
});
|
381
|
+
}
|
382
|
+
//
|
383
|
+
// Helper for draw Sparkline plots on Dashboard page
|
384
|
+
//
|
385
|
+
function SparkLineDrawBarGraph(elem, arr, color){
|
386
|
+
if (color) {
|
387
|
+
var stacked_color = color;
|
388
|
+
}
|
389
|
+
else {
|
390
|
+
stacked_color = '#6AA6D6'
|
391
|
+
}
|
392
|
+
elem.sparkline(arr, { type: 'bar', barWidth: 7, highlightColor: '#000', barSpacing: 2, height: 40, stackedBarColor: stacked_color});
|
393
|
+
}
|
394
|
+
//
|
395
|
+
// Helper for open ModalBox with requested header, content and bottom
|
396
|
+
//
|
397
|
+
//
|
398
|
+
function OpenModalBox(header, inner, bottom){
|
399
|
+
var modalbox = $('#modalbox');
|
400
|
+
modalbox.find('.modal-header-name span').html(header);
|
401
|
+
modalbox.find('.devoops-modal-inner').html(inner);
|
402
|
+
modalbox.find('.devoops-modal-bottom').html(bottom);
|
403
|
+
modalbox.fadeIn('fast');
|
404
|
+
$('body').addClass("body-expanded");
|
405
|
+
}
|
406
|
+
//
|
407
|
+
// Close modalbox
|
408
|
+
//
|
409
|
+
//
|
410
|
+
function CloseModalBox(){
|
411
|
+
var modalbox = $('#modalbox');
|
412
|
+
modalbox.fadeOut('fast', function(){
|
413
|
+
modalbox.find('.modal-header-name span').children().remove();
|
414
|
+
modalbox.find('.devoops-modal-inner').children().remove();
|
415
|
+
modalbox.find('.devoops-modal-bottom').children().remove();
|
416
|
+
$('body').removeClass("body-expanded");
|
417
|
+
});
|
418
|
+
}
|
419
|
+
//
|
420
|
+
// Beauty tables plugin (navigation in tables with inputs in cell)
|
421
|
+
// Created by DevOOPS.
|
422
|
+
//
|
423
|
+
(function( $ ){
|
424
|
+
$.fn.beautyTables = function() {
|
425
|
+
var table = this;
|
426
|
+
var string_fill = false;
|
427
|
+
this.on('keydown', function(event) {
|
428
|
+
var target = event.target;
|
429
|
+
var tr = $(target).closest("tr");
|
430
|
+
var col = $(target).closest("td");
|
431
|
+
if (target.tagName.toUpperCase() == 'INPUT'){
|
432
|
+
if (event.shiftKey === true){
|
433
|
+
switch(event.keyCode) {
|
434
|
+
case 37: // left arrow
|
435
|
+
col.prev().children("input[type=text]").focus();
|
436
|
+
break;
|
437
|
+
case 39: // right arrow
|
438
|
+
col.next().children("input[type=text]").focus();
|
439
|
+
break;
|
440
|
+
case 40: // down arrow
|
441
|
+
if (string_fill==false){
|
442
|
+
tr.next().find('td:eq('+col.index()+') input[type=text]').focus();
|
443
|
+
}
|
444
|
+
break;
|
445
|
+
case 38: // up arrow
|
446
|
+
if (string_fill==false){
|
447
|
+
tr.prev().find('td:eq('+col.index()+') input[type=text]').focus();
|
448
|
+
}
|
449
|
+
break;
|
450
|
+
}
|
451
|
+
}
|
452
|
+
if (event.ctrlKey === true){
|
453
|
+
switch(event.keyCode) {
|
454
|
+
case 37: // left arrow
|
455
|
+
tr.find('td:eq(1)').find("input[type=text]").focus();
|
456
|
+
break;
|
457
|
+
case 39: // right arrow
|
458
|
+
tr.find('td:last-child').find("input[type=text]").focus();
|
459
|
+
break;
|
460
|
+
case 40: // down arrow
|
461
|
+
if (string_fill==false){
|
462
|
+
table.find('tr:last-child td:eq('+col.index()+') input[type=text]').focus();
|
463
|
+
}
|
464
|
+
break;
|
465
|
+
case 38: // up arrow
|
466
|
+
if (string_fill==false){
|
467
|
+
table.find('tr:eq(1) td:eq('+col.index()+') input[type=text]').focus();
|
468
|
+
}
|
469
|
+
break;
|
470
|
+
}
|
471
|
+
}
|
472
|
+
if (event.keyCode == 13 || event.keyCode == 9 ) {
|
473
|
+
event.preventDefault();
|
474
|
+
col.next().find("input[type=text]").focus();
|
475
|
+
}
|
476
|
+
if (string_fill==false){
|
477
|
+
if (event.keyCode == 34) {
|
478
|
+
event.preventDefault();
|
479
|
+
table.find('tr:last-child td:last-child').find("input[type=text]").focus();}
|
480
|
+
if (event.keyCode == 33) {
|
481
|
+
event.preventDefault();
|
482
|
+
table.find('tr:eq(1) td:eq(1)').find("input[type=text]").focus();}
|
483
|
+
}
|
484
|
+
}
|
485
|
+
});
|
486
|
+
table.find("input[type=text]").each(function(){
|
487
|
+
$(this).on('blur', function(event){
|
488
|
+
var target = event.target;
|
489
|
+
var col = $(target).parents("td");
|
490
|
+
if(table.find("input[name=string-fill]").prop("checked")==true) {
|
491
|
+
col.nextAll().find("input[type=text]").each(function() {
|
492
|
+
$(this).val($(target).val());
|
493
|
+
});
|
494
|
+
}
|
495
|
+
});
|
496
|
+
})
|
497
|
+
};
|
498
|
+
})( jQuery );
|
499
|
+
//
|
500
|
+
// Beauty Hover Plugin (backlight row and col when cell in mouseover)
|
501
|
+
//
|
502
|
+
//
|
503
|
+
(function( $ ){
|
504
|
+
$.fn.beautyHover = function() {
|
505
|
+
var table = this;
|
506
|
+
table.on('mouseover','td', function() {
|
507
|
+
var idx = $(this).index();
|
508
|
+
var rows = $(this).closest('table').find('tr');
|
509
|
+
rows.each(function(){
|
510
|
+
$(this).find('td:eq('+idx+')').addClass('beauty-hover');
|
511
|
+
});
|
512
|
+
})
|
513
|
+
.on('mouseleave','td', function(e) {
|
514
|
+
var idx = $(this).index();
|
515
|
+
var rows = $(this).closest('table').find('tr');
|
516
|
+
rows.each(function(){
|
517
|
+
$(this).find('td:eq('+idx+')').removeClass('beauty-hover');
|
518
|
+
});
|
519
|
+
});
|
520
|
+
};
|
521
|
+
})( jQuery );
|
522
|
+
//
|
523
|
+
// Function convert values of inputs in table to JSON data
|
524
|
+
//
|
525
|
+
//
|
526
|
+
function Table2Json(table) {
|
527
|
+
var result = {};
|
528
|
+
table.find("tr").each(function () {
|
529
|
+
var oneRow = [];
|
530
|
+
var varname = $(this).index();
|
531
|
+
$("td", this).each(function (index) { if (index != 0) {oneRow.push($("input", this).val());}});
|
532
|
+
result[varname] = oneRow;
|
533
|
+
});
|
534
|
+
var result_json = JSON.stringify(result);
|
535
|
+
OpenModalBox('Table to JSON values', result_json);
|
536
|
+
}
|
537
|
+
/*-------------------------------------------
|
538
|
+
Demo graphs for Flot Chart page (charts_flot.html)
|
539
|
+
---------------------------------------------*/
|
540
|
+
//
|
541
|
+
// Graph1 created in element with id = box-one-content
|
542
|
+
//
|
543
|
+
function FlotGraph1(){
|
544
|
+
// We use an inline data source in the example, usually data would
|
545
|
+
// be fetched from a server
|
546
|
+
var data = [],
|
547
|
+
totalPoints = 300;
|
548
|
+
function getRandomData() {
|
549
|
+
if (data.length > 0)
|
550
|
+
data = data.slice(1);
|
551
|
+
// Do a random walk
|
552
|
+
while (data.length < totalPoints) {
|
553
|
+
var prev = data.length > 0 ? data[data.length - 1] : 50,
|
554
|
+
y = prev + Math.random() * 10 - 5;
|
555
|
+
if (y < 0) {
|
556
|
+
y = 0;
|
557
|
+
} else if (y > 100) {
|
558
|
+
y = 100;
|
559
|
+
}
|
560
|
+
data.push(y);
|
561
|
+
}
|
562
|
+
// Zip the generated y values with the x values
|
563
|
+
var res = [];
|
564
|
+
for (var i = 0; i < data.length; ++i) {
|
565
|
+
res.push([i, data[i]])
|
566
|
+
}
|
567
|
+
return res;
|
568
|
+
}
|
569
|
+
var updateInterval = 30;
|
570
|
+
var plot = $.plot("#box-one-content", [ getRandomData() ], {
|
571
|
+
series: {
|
572
|
+
shadowSize: 0 // Drawing is faster without shadows
|
573
|
+
},
|
574
|
+
yaxis: {min: 0, max: 100},
|
575
|
+
xaxis: {show: false }
|
576
|
+
});
|
577
|
+
function update() {
|
578
|
+
plot.setData([getRandomData()]);
|
579
|
+
// Since the axes don't change, we don't need to call plot.setupGrid()
|
580
|
+
plot.draw();
|
581
|
+
setTimeout(update, updateInterval);
|
582
|
+
}
|
583
|
+
update();
|
584
|
+
}
|
585
|
+
//
|
586
|
+
// Graph2 created in element with id = box-two-content
|
587
|
+
//
|
588
|
+
function FlotGraph2(){
|
589
|
+
var sin = [];
|
590
|
+
var cos = [];
|
591
|
+
var tan = [];
|
592
|
+
for (var i = 0; i < 14; i += 0.1) {
|
593
|
+
sin.push([i, Math.sin(i)]);
|
594
|
+
cos.push([i, Math.cos(i)]);
|
595
|
+
tan.push([i, Math.tan(i)/4]);
|
596
|
+
}
|
597
|
+
var plot = $.plot("#box-two-content", [
|
598
|
+
{ data: sin, label: "sin(x) = -0.00"},
|
599
|
+
{ data: cos, label: "cos(x) = -0.00" },
|
600
|
+
{ data: tan, label: "tan(x)/4 = -0.00" }
|
601
|
+
], {
|
602
|
+
series: {
|
603
|
+
lines: {
|
604
|
+
show: true
|
605
|
+
}
|
606
|
+
},
|
607
|
+
crosshair: {
|
608
|
+
mode: "x"
|
609
|
+
},
|
610
|
+
grid: {
|
611
|
+
hoverable: true,
|
612
|
+
autoHighlight: false
|
613
|
+
},
|
614
|
+
yaxis: {
|
615
|
+
min: -5.2,
|
616
|
+
max: 5.2
|
617
|
+
}
|
618
|
+
});
|
619
|
+
var legends = $("#box-two-content .legendLabel");
|
620
|
+
legends.each(function () {
|
621
|
+
// fix the widths so they don't jump around
|
622
|
+
$(this).css('width', $(this).width());
|
623
|
+
});
|
624
|
+
var updateLegendTimeout = null;
|
625
|
+
var latestPosition = null;
|
626
|
+
function updateLegend() {
|
627
|
+
updateLegendTimeout = null;
|
628
|
+
var pos = latestPosition;
|
629
|
+
var axes = plot.getAxes();
|
630
|
+
if (pos.x < axes.xaxis.min || pos.x > axes.xaxis.max ||
|
631
|
+
pos.y < axes.yaxis.min || pos.y > axes.yaxis.max) {
|
632
|
+
return;
|
633
|
+
}
|
634
|
+
var i, j, dataset = plot.getData();
|
635
|
+
for (i = 0; i < dataset.length; ++i) {
|
636
|
+
var series = dataset[i];
|
637
|
+
// Find the nearest points, x-wise
|
638
|
+
for (j = 0; j < series.data.length; ++j) {
|
639
|
+
if (series.data[j][0] > pos.x) {
|
640
|
+
break;
|
641
|
+
}
|
642
|
+
}
|
643
|
+
// Now Interpolate
|
644
|
+
var y, p1 = series.data[j - 1], p2 = series.data[j];
|
645
|
+
if (p1 == null) {
|
646
|
+
y = p2[1];
|
647
|
+
} else if (p2 == null) {
|
648
|
+
y = p1[1];
|
649
|
+
} else {
|
650
|
+
y = p1[1] + (p2[1] - p1[1]) * (pos.x - p1[0]) / (p2[0] - p1[0]);
|
651
|
+
}
|
652
|
+
legends.eq(i).text(series.label.replace(/=.*/, "= " + y.toFixed(2)));
|
653
|
+
}
|
654
|
+
}
|
655
|
+
$("#box-two-content").bind("plothover", function (event, pos, item) {
|
656
|
+
latestPosition = pos;
|
657
|
+
if (!updateLegendTimeout) {
|
658
|
+
updateLegendTimeout = setTimeout(updateLegend, 50);
|
659
|
+
}
|
660
|
+
});
|
661
|
+
}
|
662
|
+
//
|
663
|
+
// Graph3 created in element with id = box-three-content
|
664
|
+
//
|
665
|
+
function FlotGraph3(){
|
666
|
+
var d1 = [];
|
667
|
+
for (var i = 0; i <= 60; i += 1) {
|
668
|
+
d1.push([i, parseInt(Math.random() * 30 - 10)]);
|
669
|
+
}
|
670
|
+
function plotWithOptions(t) {
|
671
|
+
$.plot("#box-three-content", [{
|
672
|
+
data: d1,
|
673
|
+
color: "rgb(30, 180, 20)",
|
674
|
+
threshold: {
|
675
|
+
below: t,
|
676
|
+
color: "rgb(200, 20, 30)"
|
677
|
+
},
|
678
|
+
lines: {
|
679
|
+
steps: true
|
680
|
+
}
|
681
|
+
}]);
|
682
|
+
}
|
683
|
+
plotWithOptions(0);
|
684
|
+
}
|
685
|
+
//
|
686
|
+
// Graph4 created in element with id = box-four-content
|
687
|
+
//
|
688
|
+
function FlotGraph4(){
|
689
|
+
var d1 = [];
|
690
|
+
for (var i = 0; i < 14; i += 0.5) {
|
691
|
+
d1.push([i, Math.sin(i)]);
|
692
|
+
}
|
693
|
+
var d2 = [[0, 3], [4, 8], [8, 5], [9, 13]];
|
694
|
+
var d3 = [];
|
695
|
+
for (var i = 0; i < 14; i += 0.5) {
|
696
|
+
d3.push([i, Math.cos(i)]);
|
697
|
+
}
|
698
|
+
var d4 = [];
|
699
|
+
for (var i = 0; i < 14; i += 0.1) {
|
700
|
+
d4.push([i, Math.sqrt(i * 10)]);
|
701
|
+
}
|
702
|
+
var d5 = [];
|
703
|
+
for (var i = 0; i < 14; i += 0.5) {
|
704
|
+
d5.push([i, Math.sqrt(i)]);
|
705
|
+
}
|
706
|
+
var d6 = [];
|
707
|
+
for (var i = 0; i < 14; i += 0.5 + Math.random()) {
|
708
|
+
d6.push([i, Math.sqrt(2*i + Math.sin(i) + 5)]);
|
709
|
+
}
|
710
|
+
$.plot("#box-four-content", [{
|
711
|
+
data: d1,
|
712
|
+
lines: { show: true, fill: true }
|
713
|
+
}, {
|
714
|
+
data: d2,
|
715
|
+
bars: { show: true }
|
716
|
+
}, {
|
717
|
+
data: d3,
|
718
|
+
points: { show: true }
|
719
|
+
}, {
|
720
|
+
data: d4,
|
721
|
+
lines: { show: true }
|
722
|
+
}, {
|
723
|
+
data: d5,
|
724
|
+
lines: { show: true },
|
725
|
+
points: { show: true }
|
726
|
+
}, {
|
727
|
+
data: d6,
|
728
|
+
lines: { show: true, steps: true }
|
729
|
+
}]);
|
730
|
+
}
|
731
|
+
/*-------------------------------------------
|
732
|
+
Demo graphs for Morris Chart page (charts_morris.html)
|
733
|
+
---------------------------------------------*/
|
734
|
+
//
|
735
|
+
// Graph1 created in element with id = morris-chart-1
|
736
|
+
//
|
737
|
+
function MorrisChart1(){
|
738
|
+
var day_data = [
|
739
|
+
{"period": "2013-10-01", "licensed": 3407, "sorned": 660},
|
740
|
+
{"period": "2013-09-30", "licensed": 3351, "sorned": 629},
|
741
|
+
{"period": "2013-09-29", "licensed": 3269, "sorned": 618},
|
742
|
+
{"period": "2013-09-20", "licensed": 3246, "sorned": 661},
|
743
|
+
{"period": "2013-09-19", "licensed": 3257, "sorned": 667},
|
744
|
+
{"period": "2013-09-18", "licensed": 3248, "sorned": 627},
|
745
|
+
{"period": "2013-09-17", "licensed": 3171, "sorned": 660},
|
746
|
+
{"period": "2013-09-16", "licensed": 3171, "sorned": 676},
|
747
|
+
{"period": "2013-09-15", "licensed": 3201, "sorned": 656},
|
748
|
+
{"period": "2013-09-10", "licensed": 3215, "sorned": 622}
|
749
|
+
];
|
750
|
+
Morris.Bar({
|
751
|
+
element: 'morris-chart-1',
|
752
|
+
data: day_data,
|
753
|
+
xkey: 'period',
|
754
|
+
ykeys: ['licensed', 'sorned'],
|
755
|
+
labels: ['Licensed', 'SORN'],
|
756
|
+
xLabelAngle: 60
|
757
|
+
});
|
758
|
+
}
|
759
|
+
//
|
760
|
+
// Graph2 created in element with id = morris-chart-2
|
761
|
+
//
|
762
|
+
function MorrisChart2(){
|
763
|
+
// Use Morris.Area instead of Morris.Line
|
764
|
+
Morris.Area({
|
765
|
+
element: 'morris-chart-2',
|
766
|
+
data: [
|
767
|
+
{x: '2011 Q1', y: 3, z: 3, m: 1},
|
768
|
+
{x: '2011 Q2', y: 2, z: 0, m: 7},
|
769
|
+
{x: '2011 Q3', y: 2, z: 5, m: 2},
|
770
|
+
{x: '2011 Q4', y: 4, z: 4, m: 5},
|
771
|
+
{x: '2012 Q1', y: 6, z: 1, m: 11},
|
772
|
+
{x: '2012 Q2', y: 4, z: 4, m: 3},
|
773
|
+
{x: '2012 Q3', y: 4, z: 4, m: 7},
|
774
|
+
{x: '2012 Q4', y: 4, z: 4, m: 9}
|
775
|
+
],
|
776
|
+
xkey: 'x',
|
777
|
+
ykeys: ['y', 'z', 'm'],
|
778
|
+
labels: ['Y', 'Z', 'M']
|
779
|
+
})
|
780
|
+
.on('click', function(i, row){
|
781
|
+
console.log(i, row);
|
782
|
+
});
|
783
|
+
}
|
784
|
+
//
|
785
|
+
// Graph3 created in element with id = morris-chart-3
|
786
|
+
//
|
787
|
+
function MorrisChart3(){
|
788
|
+
var decimal_data = [];
|
789
|
+
for (var x = 0; x <= 360; x += 10) {
|
790
|
+
decimal_data.push({ x: x, y: Math.sin(Math.PI * x / 180).toFixed(4), z: Math.cos(Math.PI * x / 180).toFixed(4) });
|
791
|
+
}
|
792
|
+
Morris.Line({
|
793
|
+
element: 'morris-chart-3',
|
794
|
+
data: decimal_data,
|
795
|
+
xkey: 'x',
|
796
|
+
ykeys: ['y', 'z'],
|
797
|
+
labels: ['sin(x)', 'cos(x)'],
|
798
|
+
parseTime: false,
|
799
|
+
goals: [-1, 0, 1]
|
800
|
+
});
|
801
|
+
}
|
802
|
+
//
|
803
|
+
// Graph4 created in element with id = morris-chart-4
|
804
|
+
//
|
805
|
+
function MorrisChart4(){
|
806
|
+
// Use Morris.Bar
|
807
|
+
Morris.Bar({
|
808
|
+
element: 'morris-chart-4',
|
809
|
+
data: [
|
810
|
+
{x: '2011 Q1', y: 0},
|
811
|
+
{x: '2011 Q2', y: 1},
|
812
|
+
{x: '2011 Q3', y: 2},
|
813
|
+
{x: '2011 Q4', y: 3},
|
814
|
+
{x: '2012 Q1', y: 4},
|
815
|
+
{x: '2012 Q2', y: 5},
|
816
|
+
{x: '2012 Q3', y: 6},
|
817
|
+
{x: '2012 Q4', y: 7},
|
818
|
+
{x: '2013 Q1', y: 8},
|
819
|
+
{x: '2013 Q2', y: 7},
|
820
|
+
{x: '2013 Q3', y: 6},
|
821
|
+
{x: '2013 Q4', y: 5},
|
822
|
+
{x: '2014 Q1', y: 9}
|
823
|
+
],
|
824
|
+
xkey: 'x',
|
825
|
+
ykeys: ['y'],
|
826
|
+
labels: ['Y'],
|
827
|
+
barColors: function (row, series, type) {
|
828
|
+
if (type === 'bar') {
|
829
|
+
var red = Math.ceil(255 * row.y / this.ymax);
|
830
|
+
return 'rgb(' + red + ',0,0)';
|
831
|
+
}
|
832
|
+
else {
|
833
|
+
return '#000';
|
834
|
+
}
|
835
|
+
}
|
836
|
+
});
|
837
|
+
}
|
838
|
+
//
|
839
|
+
// Graph5 created in element with id = morris-chart-5
|
840
|
+
//
|
841
|
+
function MorrisChart5(){
|
842
|
+
Morris.Area({
|
843
|
+
element: 'morris-chart-5',
|
844
|
+
data: [
|
845
|
+
{period: '2010 Q1', iphone: 2666, ipad: null, itouch: 2647},
|
846
|
+
{period: '2010 Q2', iphone: 2778, ipad: 2294, itouch: 2441},
|
847
|
+
{period: '2010 Q3', iphone: 4912, ipad: 1969, itouch: 2501},
|
848
|
+
{period: '2010 Q4', iphone: 3767, ipad: 3597, itouch: 5689},
|
849
|
+
{period: '2011 Q1', iphone: 6810, ipad: 1914, itouch: 2293},
|
850
|
+
{period: '2011 Q2', iphone: 5670, ipad: 4293, itouch: 1881},
|
851
|
+
{period: '2011 Q3', iphone: 4820, ipad: 3795, itouch: 1588},
|
852
|
+
{period: '2011 Q4', iphone: 15073, ipad: 5967, itouch: 5175},
|
853
|
+
{period: '2012 Q1', iphone: 10687, ipad: 4460, itouch: 2028},
|
854
|
+
{period: '2012 Q2', iphone: 8432, ipad: 5713, itouch: 1791}
|
855
|
+
],
|
856
|
+
xkey: 'period',
|
857
|
+
ykeys: ['iphone', 'ipad', 'itouch'],
|
858
|
+
labels: ['iPhone', 'iPad', 'iPod Touch'],
|
859
|
+
pointSize: 2,
|
860
|
+
hideHover: 'auto'
|
861
|
+
});
|
862
|
+
}
|
863
|
+
/*-------------------------------------------
|
864
|
+
Demo graphs for Google Chart page (charts_google.html)
|
865
|
+
---------------------------------------------*/
|
866
|
+
//
|
867
|
+
// One function for create all graphs on Google Chart page
|
868
|
+
//
|
869
|
+
function DrawAllCharts(){
|
870
|
+
// Chart 1
|
871
|
+
var chart1_data = [
|
872
|
+
['Smartphones', 'PC', 'Notebooks', 'Monitors','Routers', 'Switches' ],
|
873
|
+
['01.01.2014', 1234, 2342, 344, 232,131],
|
874
|
+
['02.01.2014', 1254, 232, 314, 232, 331],
|
875
|
+
['03.01.2014', 2234, 342, 298, 232, 665],
|
876
|
+
['04.01.2014', 2234, 42, 559, 232, 321],
|
877
|
+
['05.01.2014', 1999, 82, 116, 232, 334],
|
878
|
+
['06.01.2014', 1634, 834, 884, 232, 191],
|
879
|
+
['07.01.2014', 321, 342, 383, 232, 556],
|
880
|
+
['08.01.2014', 845, 112, 499, 232, 731]
|
881
|
+
];
|
882
|
+
var chart1_options = {
|
883
|
+
title: 'Sales of company',
|
884
|
+
hAxis: {title: 'Date', titleTextStyle: {color: 'red'}},
|
885
|
+
backgroundColor: '#fcfcfc',
|
886
|
+
vAxis: {title: 'Quantity', titleTextStyle: {color: 'blue'}}
|
887
|
+
};
|
888
|
+
var chart1_element = 'google-chart-1';
|
889
|
+
var chart1_type = google.visualization.ColumnChart;
|
890
|
+
drawGoogleChart(chart1_data, chart1_options, chart1_element, chart1_type);
|
891
|
+
// Chart 2
|
892
|
+
var chart2_data = [
|
893
|
+
['Height', 'Width'],
|
894
|
+
['Samsung', 74.5],
|
895
|
+
['Apple', 31.24],
|
896
|
+
['LG', 12.10],
|
897
|
+
['Huawei', 11.14],
|
898
|
+
['Sony', 8.3],
|
899
|
+
['Nokia', 7.4],
|
900
|
+
['Blackberry', 6.8],
|
901
|
+
['HTC', 6.63],
|
902
|
+
['Motorola', 3.5],
|
903
|
+
['Other', 43.15]
|
904
|
+
];
|
905
|
+
var chart2_options = {
|
906
|
+
title: 'Smartphone marketshare 2Q 2013',
|
907
|
+
backgroundColor: '#fcfcfc'
|
908
|
+
};
|
909
|
+
var chart2_element = 'google-chart-2';
|
910
|
+
var chart2_type = google.visualization.PieChart;
|
911
|
+
drawGoogleChart(chart2_data, chart2_options, chart2_element, chart2_type);
|
912
|
+
// Chart 3
|
913
|
+
var chart3_data = [
|
914
|
+
['Age', 'Weight'],
|
915
|
+
[ 8, 12],
|
916
|
+
[ 4, 5.5],
|
917
|
+
[ 11, 14],
|
918
|
+
[ 4, 5],
|
919
|
+
[ 3, 3.5],
|
920
|
+
[ 6.5, 7]
|
921
|
+
];
|
922
|
+
var chart3_options = {
|
923
|
+
title: 'Age vs. Weight comparison',
|
924
|
+
hAxis: {title: 'Age', minValue: 0, maxValue: 15},
|
925
|
+
vAxis: {title: 'Weight', minValue: 0, maxValue: 15},
|
926
|
+
legend: 'none',
|
927
|
+
backgroundColor: '#fcfcfc'
|
928
|
+
};
|
929
|
+
var chart3_element = 'google-chart-3';
|
930
|
+
var chart3_type = google.visualization.ScatterChart;
|
931
|
+
drawGoogleChart(chart3_data, chart3_options, chart3_element, chart3_type);
|
932
|
+
// Chart 4
|
933
|
+
var chart4_data = [
|
934
|
+
['ID', 'Life Expectancy', 'Fertility Rate', 'Region', 'Population'],
|
935
|
+
['CAN', 80.66, 1.67, 'North America', 33739900],
|
936
|
+
['DEU', 79.84, 1.36, 'Europe', 81902307],
|
937
|
+
['DNK', 78.6, 1.84, 'Europe', 5523095],
|
938
|
+
['EGY', 72.73, 2.78, 'Middle East', 79716203],
|
939
|
+
['GBR', 80.05, 2, 'Europe', 61801570],
|
940
|
+
['IRN', 72.49, 1.7, 'Middle East', 73137148],
|
941
|
+
['IRQ', 68.09, 4.77, 'Middle East', 31090763],
|
942
|
+
['ISR', 81.55, 2.96, 'Middle East', 7485600],
|
943
|
+
['RUS', 68.6, 1.54, 'Europe', 141850000],
|
944
|
+
['USA', 78.09, 2.05, 'North America', 307007000]
|
945
|
+
];
|
946
|
+
var chart4_options = {
|
947
|
+
title: 'Correlation between life expectancy, fertility rate and population of some world countries (2010)',
|
948
|
+
hAxis: {title: 'Life Expectancy'},
|
949
|
+
vAxis: {title: 'Fertility Rate'},
|
950
|
+
backgroundColor: '#fcfcfc',
|
951
|
+
bubble: {textStyle: {fontSize: 11}}
|
952
|
+
};
|
953
|
+
var chart4_element = 'google-chart-4';
|
954
|
+
var chart4_type = google.visualization.BubbleChart;
|
955
|
+
drawGoogleChart(chart4_data, chart4_options, chart4_element, chart4_type);
|
956
|
+
// Chart 5
|
957
|
+
var chart5_data = [
|
958
|
+
['Country', 'Popularity'],
|
959
|
+
['Germany', 200],
|
960
|
+
['United States', 300],
|
961
|
+
['Brazil', 400],
|
962
|
+
['Canada', 500],
|
963
|
+
['France', 600],
|
964
|
+
['RU', 700]
|
965
|
+
];
|
966
|
+
var chart5_options = {
|
967
|
+
backgroundColor: '#fcfcfc',
|
968
|
+
enableRegionInteractivity: true
|
969
|
+
};
|
970
|
+
var chart5_element = 'google-chart-5';
|
971
|
+
var chart5_type = google.visualization.GeoChart;
|
972
|
+
drawGoogleChart(chart5_data, chart5_options, chart5_element, chart5_type);
|
973
|
+
// Chart 6
|
974
|
+
var chart6_data = [
|
975
|
+
['Year', 'Sales', 'Expenses'],
|
976
|
+
['2004', 1000, 400],
|
977
|
+
['2005', 1170, 460],
|
978
|
+
['2006', 660, 1120],
|
979
|
+
['2007', 1030, 540],
|
980
|
+
['2008', 2080, 740],
|
981
|
+
['2009', 1949, 690],
|
982
|
+
['2010', 2334, 820]
|
983
|
+
];
|
984
|
+
var chart6_options = {
|
985
|
+
backgroundColor: '#fcfcfc',
|
986
|
+
title: 'Company Performance'
|
987
|
+
};
|
988
|
+
var chart6_element = 'google-chart-6';
|
989
|
+
var chart6_type = google.visualization.LineChart;
|
990
|
+
drawGoogleChart(chart6_data, chart6_options, chart6_element, chart6_type);
|
991
|
+
// Chart 7
|
992
|
+
var chart7_data = [
|
993
|
+
['Task', 'Hours per Day'],
|
994
|
+
['Work', 11],
|
995
|
+
['Eat', 2],
|
996
|
+
['Commute', 2],
|
997
|
+
['Watch TV', 2],
|
998
|
+
['Sleep', 7]
|
999
|
+
];
|
1000
|
+
var chart7_options = {
|
1001
|
+
backgroundColor: '#fcfcfc',
|
1002
|
+
title: 'My Daily Activities',
|
1003
|
+
pieHole: 0.4
|
1004
|
+
};
|
1005
|
+
var chart7_element = 'google-chart-7';
|
1006
|
+
var chart7_type = google.visualization.PieChart;
|
1007
|
+
drawGoogleChart(chart7_data, chart7_options, chart7_element, chart7_type);
|
1008
|
+
// Chart 8
|
1009
|
+
var chart8_data = [
|
1010
|
+
['Generation', 'Descendants'],
|
1011
|
+
[0, 1], [1, 33], [2, 269], [3, 2013]
|
1012
|
+
];
|
1013
|
+
var chart8_options = {
|
1014
|
+
backgroundColor: '#fcfcfc',
|
1015
|
+
title: 'Descendants by Generation',
|
1016
|
+
hAxis: {title: 'Generation', minValue: 0, maxValue: 3},
|
1017
|
+
vAxis: {title: 'Descendants', minValue: 0, maxValue: 2100},
|
1018
|
+
trendlines: {
|
1019
|
+
0: {
|
1020
|
+
type: 'exponential',
|
1021
|
+
visibleInLegend: true
|
1022
|
+
}
|
1023
|
+
}
|
1024
|
+
};
|
1025
|
+
var chart8_element = 'google-chart-8';
|
1026
|
+
var chart8_type = google.visualization.ScatterChart;
|
1027
|
+
drawGoogleChart(chart8_data, chart8_options, chart8_element, chart8_type);
|
1028
|
+
}
|
1029
|
+
/*-------------------------------------------
|
1030
|
+
Demo graphs for xCharts page (charts_xcharts.html)
|
1031
|
+
---------------------------------------------*/
|
1032
|
+
//
|
1033
|
+
// Graph1 created in element with id = xchart-1
|
1034
|
+
//
|
1035
|
+
function xGraph1(){
|
1036
|
+
var tt = document.createElement('div'),
|
1037
|
+
leftOffset = -(~~$('html').css('padding-left').replace('px', '') + ~~$('body').css('margin-left').replace('px', '')),
|
1038
|
+
topOffset = -32;
|
1039
|
+
tt.className = 'ex-tooltip';
|
1040
|
+
document.body.appendChild(tt);
|
1041
|
+
var data = {
|
1042
|
+
"xScale": "time",
|
1043
|
+
"yScale": "linear",
|
1044
|
+
"main": [
|
1045
|
+
{
|
1046
|
+
"className": ".xchart-class-1",
|
1047
|
+
"data": [
|
1048
|
+
{
|
1049
|
+
"x": "2012-11-05",
|
1050
|
+
"y": 6
|
1051
|
+
},
|
1052
|
+
{
|
1053
|
+
"x": "2012-11-06",
|
1054
|
+
"y": 6
|
1055
|
+
},
|
1056
|
+
{
|
1057
|
+
"x": "2012-11-07",
|
1058
|
+
"y": 8
|
1059
|
+
},
|
1060
|
+
{
|
1061
|
+
"x": "2012-11-08",
|
1062
|
+
"y": 3
|
1063
|
+
},
|
1064
|
+
{
|
1065
|
+
"x": "2012-11-09",
|
1066
|
+
"y": 4
|
1067
|
+
},
|
1068
|
+
{
|
1069
|
+
"x": "2012-11-10",
|
1070
|
+
"y": 9
|
1071
|
+
},
|
1072
|
+
{
|
1073
|
+
"x": "2012-11-11",
|
1074
|
+
"y": 6
|
1075
|
+
},
|
1076
|
+
{
|
1077
|
+
"x": "2012-11-12",
|
1078
|
+
"y": 16
|
1079
|
+
},
|
1080
|
+
{
|
1081
|
+
"x": "2012-11-13",
|
1082
|
+
"y": 4
|
1083
|
+
},
|
1084
|
+
{
|
1085
|
+
"x": "2012-11-14",
|
1086
|
+
"y": 9
|
1087
|
+
},
|
1088
|
+
{
|
1089
|
+
"x": "2012-11-15",
|
1090
|
+
"y": 2
|
1091
|
+
}
|
1092
|
+
]
|
1093
|
+
}
|
1094
|
+
]
|
1095
|
+
};
|
1096
|
+
var opts = {
|
1097
|
+
"dataFormatX": function (x) { return d3.time.format('%Y-%m-%d').parse(x); },
|
1098
|
+
"tickFormatX": function (x) { return d3.time.format('%A')(x); },
|
1099
|
+
"mouseover": function (d, i) {
|
1100
|
+
var pos = $(this).offset();
|
1101
|
+
$(tt).text(d3.time.format('%A')(d.x) + ': ' + d.y)
|
1102
|
+
.css({top: topOffset + pos.top, left: pos.left + leftOffset})
|
1103
|
+
.show();
|
1104
|
+
},
|
1105
|
+
"mouseout": function (x) {
|
1106
|
+
$(tt).hide();
|
1107
|
+
}
|
1108
|
+
};
|
1109
|
+
var myChart = new xChart('line-dotted', data, '#xchart-1', opts);
|
1110
|
+
}
|
1111
|
+
//
|
1112
|
+
// Graph2 created in element with id = xchart-2
|
1113
|
+
//
|
1114
|
+
function xGraph2(){
|
1115
|
+
var data = {
|
1116
|
+
"xScale": "ordinal",
|
1117
|
+
"yScale": "linear",
|
1118
|
+
"main": [
|
1119
|
+
{
|
1120
|
+
"className": ".xchart-class-2",
|
1121
|
+
"data": [
|
1122
|
+
{
|
1123
|
+
"x": "Apple",
|
1124
|
+
"y": 575
|
1125
|
+
},
|
1126
|
+
{
|
1127
|
+
"x": "Facebook",
|
1128
|
+
"y": 163
|
1129
|
+
},
|
1130
|
+
{
|
1131
|
+
"x": "Microsoft",
|
1132
|
+
"y": 303
|
1133
|
+
},
|
1134
|
+
{
|
1135
|
+
"x": "Cisco",
|
1136
|
+
"y": 121
|
1137
|
+
},
|
1138
|
+
{
|
1139
|
+
"x": "Google",
|
1140
|
+
"y": 393
|
1141
|
+
}
|
1142
|
+
]
|
1143
|
+
}
|
1144
|
+
]
|
1145
|
+
};
|
1146
|
+
var myChart = new xChart('bar', data, '#xchart-2');
|
1147
|
+
}
|
1148
|
+
//
|
1149
|
+
// Graph3 created in element with id = xchart-3
|
1150
|
+
//
|
1151
|
+
function xGraph3(){
|
1152
|
+
var data = {
|
1153
|
+
"xScale": "time",
|
1154
|
+
"yScale": "linear",
|
1155
|
+
"type": "line",
|
1156
|
+
"main": [
|
1157
|
+
{
|
1158
|
+
"className": ".xchart-class-3",
|
1159
|
+
"data": [
|
1160
|
+
{
|
1161
|
+
"x": "2012-11-05",
|
1162
|
+
"y": 1
|
1163
|
+
},
|
1164
|
+
{
|
1165
|
+
"x": "2012-11-06",
|
1166
|
+
"y": 6
|
1167
|
+
},
|
1168
|
+
{
|
1169
|
+
"x": "2012-11-07",
|
1170
|
+
"y": 13
|
1171
|
+
},
|
1172
|
+
{
|
1173
|
+
"x": "2012-11-08",
|
1174
|
+
"y": -3
|
1175
|
+
},
|
1176
|
+
{
|
1177
|
+
"x": "2012-11-09",
|
1178
|
+
"y": -4
|
1179
|
+
},
|
1180
|
+
{
|
1181
|
+
"x": "2012-11-10",
|
1182
|
+
"y": 9
|
1183
|
+
},
|
1184
|
+
{
|
1185
|
+
"x": "2012-11-11",
|
1186
|
+
"y": 6
|
1187
|
+
},
|
1188
|
+
{
|
1189
|
+
"x": "2012-11-12",
|
1190
|
+
"y": 7
|
1191
|
+
},
|
1192
|
+
{
|
1193
|
+
"x": "2012-11-13",
|
1194
|
+
"y": -2
|
1195
|
+
},
|
1196
|
+
{
|
1197
|
+
"x": "2012-11-14",
|
1198
|
+
"y": -7
|
1199
|
+
}
|
1200
|
+
]
|
1201
|
+
}
|
1202
|
+
]
|
1203
|
+
};
|
1204
|
+
var opts = {
|
1205
|
+
"dataFormatX": function (x) { return d3.time.format('%Y-%m-%d').parse(x); },
|
1206
|
+
"tickFormatX": function (x) { return d3.time.format('%A')(x); }
|
1207
|
+
};
|
1208
|
+
var myChart = new xChart('line', data, '#xchart-3', opts);
|
1209
|
+
}
|
1210
|
+
/*-------------------------------------------
|
1211
|
+
Demo graphs for CoinDesk page (charts_coindesk.html)
|
1212
|
+
---------------------------------------------*/
|
1213
|
+
//
|
1214
|
+
// Main function for CoinDesk API Page
|
1215
|
+
// (we get JSON data and make 4 graph from this)
|
1216
|
+
//
|
1217
|
+
function CoinDeskGraph(){
|
1218
|
+
var dates = PrettyDates();
|
1219
|
+
var startdate = dates[0];
|
1220
|
+
var enddate = dates[1];
|
1221
|
+
// Load JSON data from CoinDesk API
|
1222
|
+
var jsonURL = 'http://api.coindesk.com/v1/bpi/historical/close.json?start='+startdate+'&end='+enddate;
|
1223
|
+
$.getJSON(jsonURL, function(result){
|
1224
|
+
// Create array of data for xChart
|
1225
|
+
$.each(result.bpi, function(key, val){
|
1226
|
+
xchart_data.push({'x': key,'y':val});
|
1227
|
+
});
|
1228
|
+
// Set handler for resize and create xChart plot
|
1229
|
+
var graphXChartResize;
|
1230
|
+
$('#coindesk-xchart').resize(function(){
|
1231
|
+
clearTimeout(graphXChartResize);
|
1232
|
+
graphXChartResize = setTimeout(DrawCoinDeskXCharts, 500);
|
1233
|
+
});
|
1234
|
+
DrawCoinDeskXCharts();
|
1235
|
+
// Create array of data for Google Chart
|
1236
|
+
$.each(result.bpi, function(key, val){
|
1237
|
+
google_data.push([key,val]);
|
1238
|
+
});
|
1239
|
+
// Set handler for resize and create Google Chart plot
|
1240
|
+
var graphGChartResize;
|
1241
|
+
$('#coindesk-google-chart').resize(function(){
|
1242
|
+
clearTimeout(graphGChartResize);
|
1243
|
+
graphGChartResize = setTimeout(DrawCoinDeskGoogleCharts, 500);
|
1244
|
+
});
|
1245
|
+
DrawCoinDeskGoogleCharts();
|
1246
|
+
// Create array of data for Flot and Sparkline
|
1247
|
+
$.each(result.bpi, function(key, val){
|
1248
|
+
var parseDate=key;
|
1249
|
+
parseDate=parseDate.split("-");
|
1250
|
+
var newDate=parseDate[1]+"/"+parseDate[2]+"/"+parseDate[0];
|
1251
|
+
var new_date = new Date(newDate).getTime();
|
1252
|
+
exchange_rate.push([new_date,val]);
|
1253
|
+
});
|
1254
|
+
// Create Flot plot (not need bind to resize, cause Flot use plugin 'resize')
|
1255
|
+
DrawCoinDeskFlot();
|
1256
|
+
// Set handler for resize and create Sparkline plot
|
1257
|
+
var graphSparklineResize;
|
1258
|
+
$('#coindesk-sparklines').resize(function(){
|
1259
|
+
clearTimeout(graphSparklineResize);
|
1260
|
+
graphSparklineResize = setTimeout(DrawCoinDeskSparkLine, 500);
|
1261
|
+
});
|
1262
|
+
DrawCoinDeskSparkLine();
|
1263
|
+
});
|
1264
|
+
}
|
1265
|
+
//
|
1266
|
+
// Draw Sparkline Graph on Coindesk page
|
1267
|
+
//
|
1268
|
+
function DrawCoinDeskSparkLine(){
|
1269
|
+
$('#coindesk-sparklines').sparkline(exchange_rate, { height: '100%', width: '100%' });
|
1270
|
+
}
|
1271
|
+
//
|
1272
|
+
// Draw xChart Graph on Coindesk page
|
1273
|
+
//
|
1274
|
+
function DrawCoinDeskXCharts(){
|
1275
|
+
var data = {
|
1276
|
+
"xScale": "ordinal",
|
1277
|
+
"yScale": "linear",
|
1278
|
+
"main": [
|
1279
|
+
{
|
1280
|
+
"className": ".pizza",
|
1281
|
+
"data": xchart_data
|
1282
|
+
}
|
1283
|
+
]
|
1284
|
+
};
|
1285
|
+
var myChart = new xChart('line-dotted', data, '#coindesk-xchart');
|
1286
|
+
}
|
1287
|
+
//
|
1288
|
+
// Draw Flot Graph on Coindesk page
|
1289
|
+
//
|
1290
|
+
function DrawCoinDeskFlot(){
|
1291
|
+
var data1 = [
|
1292
|
+
{ data: exchange_rate, label: "Bitcoin exchange rate ($)" }
|
1293
|
+
];
|
1294
|
+
var options = {
|
1295
|
+
canvas: true,
|
1296
|
+
xaxes: [
|
1297
|
+
{ mode: "time" }
|
1298
|
+
],
|
1299
|
+
yaxes: [
|
1300
|
+
{ min: 0 },
|
1301
|
+
{
|
1302
|
+
position: "right",
|
1303
|
+
alignTicksWithAxis: 1,
|
1304
|
+
tickFormatter: function (value, axis) {
|
1305
|
+
return value.toFixed(axis.tickDecimals) + "€";
|
1306
|
+
}
|
1307
|
+
}
|
1308
|
+
],
|
1309
|
+
legend: { position: "sw" }
|
1310
|
+
};
|
1311
|
+
$.plot("#coindesk-flot", data1, options);
|
1312
|
+
}
|
1313
|
+
//
|
1314
|
+
// Draw Google Chart Graph on Coindesk page
|
1315
|
+
//
|
1316
|
+
function DrawCoinDeskGoogleCharts(){
|
1317
|
+
var google_options = {
|
1318
|
+
backgroundColor: '#fcfcfc',
|
1319
|
+
title: 'Coindesk Exchange Rate'
|
1320
|
+
};
|
1321
|
+
var google_element = 'coindesk-google-chart';
|
1322
|
+
var google_type = google.visualization.LineChart;
|
1323
|
+
drawGoogleChart(google_data, google_options, google_element, google_type);
|
1324
|
+
}
|
1325
|
+
/*-------------------------------------------
|
1326
|
+
Scripts for DataTables page (tables_datatables.html)
|
1327
|
+
---------------------------------------------*/
|
1328
|
+
//
|
1329
|
+
// Function for table, located in element with id = datatable-1
|
1330
|
+
//
|
1331
|
+
function TestTable1(){
|
1332
|
+
$('#datatable-1').dataTable( {
|
1333
|
+
"aaSorting": [[ 0, "asc" ]],
|
1334
|
+
"sDom": "<'box-content'<'col-sm-6'f><'col-sm-6 text-right'l><'clearfix'>>rt<'box-content'<'col-sm-6'i><'col-sm-6 text-right'p><'clearfix'>>",
|
1335
|
+
"sPaginationType": "bootstrap",
|
1336
|
+
"oLanguage": {
|
1337
|
+
"sSearch": "",
|
1338
|
+
"sLengthMenu": '_MENU_'
|
1339
|
+
}
|
1340
|
+
});
|
1341
|
+
}
|
1342
|
+
//
|
1343
|
+
// Function for table, located in element with id = datatable-2
|
1344
|
+
//
|
1345
|
+
function TestTable2(){
|
1346
|
+
var asInitVals = [];
|
1347
|
+
var oTable = $('#datatable-2').dataTable( {
|
1348
|
+
"aaSorting": [[ 0, "asc" ]],
|
1349
|
+
"sDom": "<'box-content'<'col-sm-6'f><'col-sm-6 text-right'l><'clearfix'>>rt<'box-content'<'col-sm-6'i><'col-sm-6 text-right'p><'clearfix'>>",
|
1350
|
+
"sPaginationType": "bootstrap",
|
1351
|
+
"oLanguage": {
|
1352
|
+
"sSearch": "",
|
1353
|
+
"sLengthMenu": '_MENU_'
|
1354
|
+
},
|
1355
|
+
bAutoWidth: false
|
1356
|
+
});
|
1357
|
+
var header_inputs = $("#datatable-2 thead input");
|
1358
|
+
header_inputs.on('keyup', function(){
|
1359
|
+
/* Filter on the column (the index) of this element */
|
1360
|
+
oTable.fnFilter( this.value, header_inputs.index(this) );
|
1361
|
+
})
|
1362
|
+
.on('focus', function(){
|
1363
|
+
if ( this.className == "search_init" ){
|
1364
|
+
this.className = "";
|
1365
|
+
this.value = "";
|
1366
|
+
}
|
1367
|
+
})
|
1368
|
+
.on('blur', function (i) {
|
1369
|
+
if ( this.value == "" ){
|
1370
|
+
this.className = "search_init";
|
1371
|
+
this.value = asInitVals[header_inputs.index(this)];
|
1372
|
+
}
|
1373
|
+
});
|
1374
|
+
header_inputs.each( function (i) {
|
1375
|
+
asInitVals[i] = this.value;
|
1376
|
+
});
|
1377
|
+
}
|
1378
|
+
//
|
1379
|
+
// Function for table, located in element with id = datatable-3
|
1380
|
+
//
|
1381
|
+
function TestTable3(){
|
1382
|
+
$('#datatable-3').dataTable( {
|
1383
|
+
"aaSorting": [[ 0, "asc" ]],
|
1384
|
+
"sDom": "T<'box-content'<'col-sm-6'f><'col-sm-6 text-right'l><'clearfix'>>rt<'box-content'<'col-sm-6'i><'col-sm-6 text-right'p><'clearfix'>>",
|
1385
|
+
"sPaginationType": "bootstrap",
|
1386
|
+
"oLanguage": {
|
1387
|
+
"sSearch": "",
|
1388
|
+
"sLengthMenu": '_MENU_'
|
1389
|
+
},
|
1390
|
+
"oTableTools": {
|
1391
|
+
"sSwfPath": "plugins/datatables/copy_csv_xls_pdf.swf",
|
1392
|
+
"aButtons": [
|
1393
|
+
"copy",
|
1394
|
+
"print",
|
1395
|
+
{
|
1396
|
+
"sExtends": "collection",
|
1397
|
+
"sButtonText": 'Save <span class="caret" />',
|
1398
|
+
"aButtons": [ "csv", "xls", "pdf" ]
|
1399
|
+
}
|
1400
|
+
]
|
1401
|
+
}
|
1402
|
+
});
|
1403
|
+
}
|
1404
|
+
/*-------------------------------------------
|
1405
|
+
Functions for Dashboard page (dashboard.html)
|
1406
|
+
---------------------------------------------*/
|
1407
|
+
//
|
1408
|
+
// Helper for random change data (only test data for Sparkline plots)
|
1409
|
+
//
|
1410
|
+
function SmallChangeVal(val) {
|
1411
|
+
var new_val = Math.floor(100*Math.random());
|
1412
|
+
var plusOrMinus = Math.random() < 0.5 ? -1 : 1;
|
1413
|
+
var result = val[0]+new_val*plusOrMinus;
|
1414
|
+
if (parseInt(result) > 1000){
|
1415
|
+
return [val[0] - new_val]
|
1416
|
+
}
|
1417
|
+
if (parseInt(result) < 0){
|
1418
|
+
return [val[0] + new_val]
|
1419
|
+
}
|
1420
|
+
return [result];
|
1421
|
+
}
|
1422
|
+
//
|
1423
|
+
// Make array of random data
|
1424
|
+
//
|
1425
|
+
function SparklineTestData(){
|
1426
|
+
var arr = [];
|
1427
|
+
for (var i=1; i<9; i++){
|
1428
|
+
arr.push([Math.floor(1000*Math.random())])
|
1429
|
+
}
|
1430
|
+
return arr;
|
1431
|
+
}
|
1432
|
+
//
|
1433
|
+
// Redraw Knob charts on Dashboard (panel- servers)
|
1434
|
+
//
|
1435
|
+
function RedrawKnob(elem){
|
1436
|
+
elem.animate({
|
1437
|
+
value: Math.floor(100*Math.random())
|
1438
|
+
},{
|
1439
|
+
duration: 3000,
|
1440
|
+
easing:'swing',
|
1441
|
+
progress: function()
|
1442
|
+
{
|
1443
|
+
$(this).val(parseInt(Math.ceil(elem.val()))).trigger('change');
|
1444
|
+
}
|
1445
|
+
});
|
1446
|
+
}
|
1447
|
+
//
|
1448
|
+
// Draw 3 Sparkline plot in Dashboard header
|
1449
|
+
//
|
1450
|
+
function SparklineLoop(){
|
1451
|
+
SparkLineDrawBarGraph($('#sparkline-1'), sparkline_arr_1.map(SmallChangeVal));
|
1452
|
+
SparkLineDrawBarGraph($('#sparkline-2'), sparkline_arr_2.map(SmallChangeVal), '#7BC5D3');
|
1453
|
+
SparkLineDrawBarGraph($('#sparkline-3'), sparkline_arr_3.map(SmallChangeVal), '#B25050');
|
1454
|
+
}
|
1455
|
+
//
|
1456
|
+
// Draw Morris charts on Dashboard (panel- Statistics + 3 donut)
|
1457
|
+
//
|
1458
|
+
function MorrisDashboard(){
|
1459
|
+
Morris.Line({
|
1460
|
+
element: 'stat-graph',
|
1461
|
+
data: [
|
1462
|
+
{"period": "2014-01", "Win8": 13.4, "Win7": 55.3, 'Vista': 1.5, 'NT': 0.3, 'XP':11, 'Linux': 4.9, 'Mac': 9.6 , 'Mobile':4},
|
1463
|
+
{"period": "2013-12", "Win8": 10, "Win7": 55.9, 'Vista': 1.5, 'NT': 3.1, 'XP':11.6, 'Linux': 4.8, 'Mac': 9.2 , 'Mobile':3.8},
|
1464
|
+
{"period": "2013-11", "Win8": 8.6, "Win7": 56.4, 'Vista': 1.6, 'NT': 3.7, 'XP':11.7, 'Linux': 4.8, 'Mac': 9.6 , 'Mobile':3.7},
|
1465
|
+
{"period": "2013-10", "Win8": 9.9, "Win7": 56.7, 'Vista': 1.6, 'NT': 1.4, 'XP':12.4, 'Linux': 4.9, 'Mac': 9.6 , 'Mobile':3.3},
|
1466
|
+
{"period": "2013-09", "Win8": 10.2, "Win7": 56.8, 'Vista': 1.6, 'NT': 0.4, 'XP':13.5, 'Linux': 4.8, 'Mac': 9.3 , 'Mobile':3.3},
|
1467
|
+
{"period": "2013-08", "Win8": 9.6, "Win7": 55.9, 'Vista': 1.7, 'NT': 0.4, 'XP':14.7, 'Linux': 5, 'Mac': 9.2 , 'Mobile':3.4},
|
1468
|
+
{"period": "2013-07", "Win8": 9, "Win7": 56.2, 'Vista': 1.8, 'NT': 0.4, 'XP':15.8, 'Linux': 4.9, 'Mac': 8.7 , 'Mobile':3.2},
|
1469
|
+
{"period": "2013-06", "Win8": 8.6, "Win7": 56.3, 'Vista': 2, 'NT': 0.4, 'XP':15.4, 'Linux': 4.9, 'Mac': 9.1 , 'Mobile':3.2},
|
1470
|
+
{"period": "2013-05", "Win8": 7.9, "Win7": 56.4, 'Vista': 2.1, 'NT': 0.4, 'XP':15.7, 'Linux': 4.9, 'Mac': 9.7 , 'Mobile':2.6},
|
1471
|
+
{"period": "2013-04", "Win8": 7.3, "Win7": 56.4, 'Vista': 2.2, 'NT': 0.4, 'XP':16.4, 'Linux': 4.8, 'Mac': 9.7 , 'Mobile':2.2},
|
1472
|
+
{"period": "2013-03", "Win8": 6.7, "Win7": 55.9, 'Vista': 2.4, 'NT': 0.4, 'XP':17.6, 'Linux': 4.7, 'Mac': 9.5 , 'Mobile':2.3},
|
1473
|
+
{"period": "2013-02", "Win8": 5.7, "Win7": 55.3, 'Vista': 2.4, 'NT': 0.4, 'XP':19.1, 'Linux': 4.8, 'Mac': 9.6 , 'Mobile':2.2},
|
1474
|
+
{"period": "2013-01", "Win8": 4.8, "Win7": 55.3, 'Vista': 2.6, 'NT': 0.5, 'XP':19.9, 'Linux': 4.8, 'Mac': 9.3 , 'Mobile':2.2}
|
1475
|
+
],
|
1476
|
+
xkey: 'period',
|
1477
|
+
ykeys: ['Win8', 'Win7','Vista','NT','XP', 'Linux', 'Mac', 'Mobile'],
|
1478
|
+
labels: ['Win8', 'Win7','Vista','NT','XP', 'Linux', 'Mac', 'Mobile']
|
1479
|
+
});
|
1480
|
+
Morris.Donut({
|
1481
|
+
element: 'morris_donut_1',
|
1482
|
+
data: [
|
1483
|
+
{value: 70, label: 'pay', formatted: 'at least 70%' },
|
1484
|
+
{value: 15, label: 'client', formatted: 'approx. 15%' },
|
1485
|
+
{value: 10, label: 'buy', formatted: 'approx. 10%' },
|
1486
|
+
{value: 5, label: 'hosted', formatted: 'at most 5%' }
|
1487
|
+
],
|
1488
|
+
formatter: function (x, data) { return data.formatted; }
|
1489
|
+
});
|
1490
|
+
Morris.Donut({
|
1491
|
+
element: 'morris_donut_2',
|
1492
|
+
data: [
|
1493
|
+
{value: 20, label: 'office', formatted: 'current' },
|
1494
|
+
{value: 35, label: 'store', formatted: 'approx. 35%' },
|
1495
|
+
{value: 20, label: 'shop', formatted: 'approx. 20%' },
|
1496
|
+
{value: 25, label: 'cars', formatted: 'at most 25%' }
|
1497
|
+
],
|
1498
|
+
formatter: function (x, data) { return data.formatted; }
|
1499
|
+
});
|
1500
|
+
Morris.Donut({
|
1501
|
+
element: 'morris_donut_3',
|
1502
|
+
data: [
|
1503
|
+
{value: 17, label: 'current', formatted: 'current' },
|
1504
|
+
{value: 22, label: 'week', formatted: 'last week' },
|
1505
|
+
{value: 10, label: 'month', formatted: 'last month' },
|
1506
|
+
{value: 25, label: 'period', formatted: 'period' },
|
1507
|
+
{value: 25, label: 'year', formatted: 'this year' }
|
1508
|
+
],
|
1509
|
+
formatter: function (x, data) { return data.formatted; }
|
1510
|
+
});
|
1511
|
+
}
|
1512
|
+
//
|
1513
|
+
// Draw SparkLine example Charts for Dashboard (table- Tickers)
|
1514
|
+
//
|
1515
|
+
function DrawSparklineDashboard(){
|
1516
|
+
SparklineLoop();
|
1517
|
+
setInterval(SparklineLoop, 1000);
|
1518
|
+
var sparkline_clients = [[309],[223], [343], [652], [455], [18], [912],[15]];
|
1519
|
+
$('.bar').each(function(){
|
1520
|
+
$(this).sparkline(sparkline_clients.map(SmallChangeVal), {type: 'bar', barWidth: 5, highlightColor: '#000', barSpacing: 2, height: 30, stackedBarColor: '#6AA6D6'});
|
1521
|
+
});
|
1522
|
+
var sparkline_table = [ [1,341], [2,464], [4,564], [5,235], [6,335], [7,535], [8,642], [9,342], [10,765] ];
|
1523
|
+
$('.td-graph').each(function(){
|
1524
|
+
var arr = $.map( sparkline_table, function(val, index) {
|
1525
|
+
return [[val[0], SmallChangeVal([val[1]])]];
|
1526
|
+
});
|
1527
|
+
$(this).sparkline( arr ,
|
1528
|
+
{defaultPixelsPerValue: 10, minSpotColor: null, maxSpotColor: null, spotColor: null,
|
1529
|
+
fillColor: false, lineWidth: 2, lineColor: '#5A8DB6'});
|
1530
|
+
});
|
1531
|
+
}
|
1532
|
+
//
|
1533
|
+
// Draw Knob Charts for Dashboard (for servers)
|
1534
|
+
//
|
1535
|
+
function DrawKnobDashboard(){
|
1536
|
+
var srv_monitoring_selectors = [
|
1537
|
+
$("#knob-srv-1"),$("#knob-srv-2"),$("#knob-srv-3"),
|
1538
|
+
$("#knob-srv-4"),$("#knob-srv-5"),$("#knob-srv-6")
|
1539
|
+
];
|
1540
|
+
srv_monitoring_selectors.forEach(DrawKnob);
|
1541
|
+
setInterval(function(){
|
1542
|
+
srv_monitoring_selectors.forEach(RedrawKnob);
|
1543
|
+
}, 3000);
|
1544
|
+
}
|
1545
|
+
/*-------------------------------------------
|
1546
|
+
Function for File upload page (form_file_uploader.html)
|
1547
|
+
---------------------------------------------*/
|
1548
|
+
function FileUpload(){
|
1549
|
+
$('#bootstrapped-fine-uploader').fineUploader({
|
1550
|
+
template: 'qq-template-bootstrap',
|
1551
|
+
classes: {
|
1552
|
+
success: 'alert alert-success',
|
1553
|
+
fail: 'alert alert-error'
|
1554
|
+
},
|
1555
|
+
thumbnails: {
|
1556
|
+
placeholders: {
|
1557
|
+
waitingPath: "assets/waiting-generic.png",
|
1558
|
+
notAvailablePath: "assets/not_available-generic.png"
|
1559
|
+
}
|
1560
|
+
},
|
1561
|
+
request: {
|
1562
|
+
endpoint: 'server/handleUploads'
|
1563
|
+
},
|
1564
|
+
validation: {
|
1565
|
+
allowedExtensions: ['jpeg', 'jpg', 'gif', 'png']
|
1566
|
+
}
|
1567
|
+
});
|
1568
|
+
}
|
1569
|
+
/*-------------------------------------------
|
1570
|
+
Function for OpenStreetMap page (maps.html)
|
1571
|
+
---------------------------------------------*/
|
1572
|
+
//
|
1573
|
+
// Load GeoIP JSON data and draw 3 maps
|
1574
|
+
//
|
1575
|
+
function LoadTestMap(){
|
1576
|
+
$.getJSON("http://www.telize.com/geoip?callback=?",
|
1577
|
+
function(json) {
|
1578
|
+
var osmap = new OpenLayers.Layer.OSM("OpenStreetMap");//создание слоя карты
|
1579
|
+
var googlestreets = new OpenLayers.Layer.Google("Google Streets", {numZoomLevels: 22,visibility: false});
|
1580
|
+
var googlesattelite = new OpenLayers.Layer.Google( "Google Sattelite", {type: google.maps.MapTypeId.SATELLITE, numZoomLevels: 22});
|
1581
|
+
var map1_layers = [googlestreets,osmap, googlesattelite];
|
1582
|
+
// Create map in element with ID - map-1
|
1583
|
+
var map1 = drawMap(json.longitude, json.latitude, "map-1", map1_layers);
|
1584
|
+
$("#map-1").resize(function(){ setTimeout(map1.updateSize(), 500); });
|
1585
|
+
// Create map in element with ID - map-2
|
1586
|
+
var osmap1 = new OpenLayers.Layer.OSM("OpenStreetMap");//создание слоя карты
|
1587
|
+
var map2_layers = [osmap1];
|
1588
|
+
var map2 = drawMap(json.longitude, json.latitude, "map-2", map2_layers);
|
1589
|
+
$("#map-2").resize(function(){ setTimeout(map2.updateSize(), 500); });
|
1590
|
+
// Create map in element with ID - map-3
|
1591
|
+
var sattelite = new OpenLayers.Layer.Google( "Google Sattelite", {type: google.maps.MapTypeId.SATELLITE, numZoomLevels: 22});
|
1592
|
+
var map3_layers = [sattelite];
|
1593
|
+
var map3 = drawMap(json.longitude, json.latitude, "map-3", map3_layers);
|
1594
|
+
$("#map-3").resize(function(){ setTimeout(map3.updateSize(), 500); });
|
1595
|
+
}
|
1596
|
+
);
|
1597
|
+
}
|
1598
|
+
/*-------------------------------------------
|
1599
|
+
Function for Fullscreen Map page (map_fullscreen.html)
|
1600
|
+
---------------------------------------------*/
|
1601
|
+
//
|
1602
|
+
// Create Fullscreen Map
|
1603
|
+
//
|
1604
|
+
function FullScreenMap(){
|
1605
|
+
$.getJSON("http://www.telize.com/geoip?callback=?",
|
1606
|
+
function(json) {
|
1607
|
+
var osmap = new OpenLayers.Layer.OSM("OpenStreetMap");//создание слоя карты
|
1608
|
+
var googlestreets = new OpenLayers.Layer.Google("Google Streets", {numZoomLevels: 22,visibility: false});
|
1609
|
+
var googlesattelite = new OpenLayers.Layer.Google( "Google Sattelite", {type: google.maps.MapTypeId.SATELLITE, numZoomLevels: 22});
|
1610
|
+
var map1_layers = [googlestreets,osmap, googlesattelite];
|
1611
|
+
var map_fs = drawMap(json.longitude, json.latitude, "full-map", map1_layers);
|
1612
|
+
}
|
1613
|
+
);
|
1614
|
+
}
|
1615
|
+
/*-------------------------------------------
|
1616
|
+
Function for Flickr Gallery page (gallery_flickr.html)
|
1617
|
+
---------------------------------------------*/
|
1618
|
+
//
|
1619
|
+
// Load data from Flicks, parse and create gallery
|
1620
|
+
//
|
1621
|
+
function displayFlickrImages(data){
|
1622
|
+
var res;
|
1623
|
+
$.each(data.items, function(i,item){
|
1624
|
+
if (i >11) { return false;}
|
1625
|
+
res = "<a href=" + item.link + " title=" + item.title + " target=\"_blank\"><img alt=" + item.title + " src=" + item.media.m + " /></a>";
|
1626
|
+
$('#box-one-content').append(res);
|
1627
|
+
});
|
1628
|
+
setTimeout(function(){
|
1629
|
+
$("#box-one-content").justifiedGallery({
|
1630
|
+
'usedSuffix':'lt240',
|
1631
|
+
'justifyLastRow':true,
|
1632
|
+
'rowHeight':150,
|
1633
|
+
'fixedHeight':false,
|
1634
|
+
'captions':true,
|
1635
|
+
'margins':1
|
1636
|
+
});
|
1637
|
+
$('#box-one-content').fadeIn('slow');
|
1638
|
+
}, 100);
|
1639
|
+
}
|
1640
|
+
/*-------------------------------------------
|
1641
|
+
Function for Form Layout page (form layouts.html)
|
1642
|
+
---------------------------------------------*/
|
1643
|
+
//
|
1644
|
+
// Example form validator function
|
1645
|
+
//
|
1646
|
+
function DemoFormValidator(){
|
1647
|
+
$('#defaultForm').bootstrapValidator({
|
1648
|
+
message: 'This value is not valid',
|
1649
|
+
fields: {
|
1650
|
+
username: {
|
1651
|
+
message: 'The username is not valid',
|
1652
|
+
validators: {
|
1653
|
+
notEmpty: {
|
1654
|
+
message: 'The username is required and can\'t be empty'
|
1655
|
+
},
|
1656
|
+
stringLength: {
|
1657
|
+
min: 6,
|
1658
|
+
max: 30,
|
1659
|
+
message: 'The username must be more than 6 and less than 30 characters long'
|
1660
|
+
},
|
1661
|
+
regexp: {
|
1662
|
+
regexp: /^[a-zA-Z0-9_\.]+$/,
|
1663
|
+
message: 'The username can only consist of alphabetical, number, dot and underscore'
|
1664
|
+
}
|
1665
|
+
}
|
1666
|
+
},
|
1667
|
+
country: {
|
1668
|
+
validators: {
|
1669
|
+
notEmpty: {
|
1670
|
+
message: 'The country is required and can\'t be empty'
|
1671
|
+
}
|
1672
|
+
}
|
1673
|
+
},
|
1674
|
+
acceptTerms: {
|
1675
|
+
validators: {
|
1676
|
+
notEmpty: {
|
1677
|
+
message: 'You have to accept the terms and policies'
|
1678
|
+
}
|
1679
|
+
}
|
1680
|
+
},
|
1681
|
+
email: {
|
1682
|
+
validators: {
|
1683
|
+
notEmpty: {
|
1684
|
+
message: 'The email address is required and can\'t be empty'
|
1685
|
+
},
|
1686
|
+
emailAddress: {
|
1687
|
+
message: 'The input is not a valid email address'
|
1688
|
+
}
|
1689
|
+
}
|
1690
|
+
},
|
1691
|
+
website: {
|
1692
|
+
validators: {
|
1693
|
+
uri: {
|
1694
|
+
message: 'The input is not a valid URL'
|
1695
|
+
}
|
1696
|
+
}
|
1697
|
+
},
|
1698
|
+
phoneNumber: {
|
1699
|
+
validators: {
|
1700
|
+
digits: {
|
1701
|
+
message: 'The value can contain only digits'
|
1702
|
+
}
|
1703
|
+
}
|
1704
|
+
},
|
1705
|
+
color: {
|
1706
|
+
validators: {
|
1707
|
+
hexColor: {
|
1708
|
+
message: 'The input is not a valid hex color'
|
1709
|
+
}
|
1710
|
+
}
|
1711
|
+
},
|
1712
|
+
zipCode: {
|
1713
|
+
validators: {
|
1714
|
+
usZipCode: {
|
1715
|
+
message: 'The input is not a valid US zip code'
|
1716
|
+
}
|
1717
|
+
}
|
1718
|
+
},
|
1719
|
+
password: {
|
1720
|
+
validators: {
|
1721
|
+
notEmpty: {
|
1722
|
+
message: 'The password is required and can\'t be empty'
|
1723
|
+
},
|
1724
|
+
identical: {
|
1725
|
+
field: 'confirmPassword',
|
1726
|
+
message: 'The password and its confirm are not the same'
|
1727
|
+
}
|
1728
|
+
}
|
1729
|
+
},
|
1730
|
+
confirmPassword: {
|
1731
|
+
validators: {
|
1732
|
+
notEmpty: {
|
1733
|
+
message: 'The confirm password is required and can\'t be empty'
|
1734
|
+
},
|
1735
|
+
identical: {
|
1736
|
+
field: 'password',
|
1737
|
+
message: 'The password and its confirm are not the same'
|
1738
|
+
}
|
1739
|
+
}
|
1740
|
+
},
|
1741
|
+
ages: {
|
1742
|
+
validators: {
|
1743
|
+
lessThan: {
|
1744
|
+
value: 100,
|
1745
|
+
inclusive: true,
|
1746
|
+
message: 'The ages has to be less than 100'
|
1747
|
+
},
|
1748
|
+
greaterThan: {
|
1749
|
+
value: 10,
|
1750
|
+
inclusive: false,
|
1751
|
+
message: 'The ages has to be greater than or equals to 10'
|
1752
|
+
}
|
1753
|
+
}
|
1754
|
+
}
|
1755
|
+
}
|
1756
|
+
});
|
1757
|
+
}
|
1758
|
+
//
|
1759
|
+
// Function for Dynamically Change input size on Form Layout page
|
1760
|
+
//
|
1761
|
+
function FormLayoutExampleInputLength(selector){
|
1762
|
+
var steps = [
|
1763
|
+
"col-sm-1",
|
1764
|
+
"col-sm-2",
|
1765
|
+
"col-sm-3",
|
1766
|
+
"col-sm-4",
|
1767
|
+
"col-sm-5",
|
1768
|
+
"col-sm-6",
|
1769
|
+
"col-sm-7",
|
1770
|
+
"col-sm-8",
|
1771
|
+
"col-sm-9",
|
1772
|
+
"col-sm-10",
|
1773
|
+
"col-sm-11",
|
1774
|
+
"col-sm-12"
|
1775
|
+
];
|
1776
|
+
selector.slider({
|
1777
|
+
range: 'min',
|
1778
|
+
value: 1,
|
1779
|
+
min: 0,
|
1780
|
+
max: 11,
|
1781
|
+
step: 1,
|
1782
|
+
slide: function(event, ui) {
|
1783
|
+
if (ui.value < 1) {
|
1784
|
+
return false;
|
1785
|
+
}
|
1786
|
+
var input = $("#form-styles");
|
1787
|
+
var f = input.parent();
|
1788
|
+
f.removeClass();
|
1789
|
+
f.addClass(steps[ui.value]);
|
1790
|
+
input.attr("placeholder",'.'+steps[ui.value]);
|
1791
|
+
}
|
1792
|
+
});
|
1793
|
+
}
|
1794
|
+
/*-------------------------------------------
|
1795
|
+
Functions for Progressbar page (ui_progressbars.html)
|
1796
|
+
---------------------------------------------*/
|
1797
|
+
//
|
1798
|
+
// Function for Knob clock
|
1799
|
+
//
|
1800
|
+
function RunClock() {
|
1801
|
+
var second = $(".second");
|
1802
|
+
var minute = $(".minute");
|
1803
|
+
var hour = $(".hour");
|
1804
|
+
var d = new Date();
|
1805
|
+
var s = d.getSeconds();
|
1806
|
+
var m = d.getMinutes();
|
1807
|
+
var h = d.getHours();
|
1808
|
+
if (h > 11) {h = h-12;}
|
1809
|
+
$('#knob-clock-value').html(h+':'+m+':'+s);
|
1810
|
+
second.val(s).trigger("change");
|
1811
|
+
minute.val(m).trigger("change");
|
1812
|
+
hour.val(h).trigger("change");
|
1813
|
+
}
|
1814
|
+
//
|
1815
|
+
// Function for create test sliders on Progressbar page
|
1816
|
+
//
|
1817
|
+
function CreateAllSliders(){
|
1818
|
+
$(".slider-default").slider();
|
1819
|
+
var slider_range_min_amount = $(".slider-range-min-amount");
|
1820
|
+
var slider_range_min = $(".slider-range-min");
|
1821
|
+
var slider_range_max = $(".slider-range-max");
|
1822
|
+
var slider_range_max_amount = $(".slider-range-max-amount");
|
1823
|
+
var slider_range = $(".slider-range");
|
1824
|
+
var slider_range_amount = $(".slider-range-amount");
|
1825
|
+
slider_range_min.slider({
|
1826
|
+
range: "min",
|
1827
|
+
value: 37,
|
1828
|
+
min: 1,
|
1829
|
+
max: 700,
|
1830
|
+
slide: function( event, ui ) {
|
1831
|
+
slider_range_min_amount.val( "$" + ui.value );
|
1832
|
+
}
|
1833
|
+
});
|
1834
|
+
slider_range_min_amount.val("$" + slider_range_min.slider( "value" ));
|
1835
|
+
slider_range_max.slider({
|
1836
|
+
range: "max",
|
1837
|
+
min: 1,
|
1838
|
+
max: 100,
|
1839
|
+
value: 2,
|
1840
|
+
slide: function( event, ui ) {
|
1841
|
+
slider_range_max_amount.val( ui.value );
|
1842
|
+
}
|
1843
|
+
});
|
1844
|
+
slider_range_max_amount.val(slider_range_max.slider( "value" ));
|
1845
|
+
slider_range.slider({
|
1846
|
+
range: true,
|
1847
|
+
min: 0,
|
1848
|
+
max: 500,
|
1849
|
+
values: [ 75, 300 ],
|
1850
|
+
slide: function( event, ui ) {
|
1851
|
+
slider_range_amount.val( "$" + ui.values[ 0 ] + " - $" + ui.values[ 1 ] );
|
1852
|
+
}
|
1853
|
+
});
|
1854
|
+
slider_range_amount.val( "$" + slider_range.slider( "values", 0 ) +
|
1855
|
+
" - $" + slider_range.slider( "values", 1 ) );
|
1856
|
+
$( "#equalizer > div.progress > div" ).each(function() {
|
1857
|
+
// read initial values from markup and remove that
|
1858
|
+
var value = parseInt( $( this ).text(), 10 );
|
1859
|
+
$( this ).empty().slider({
|
1860
|
+
value: value,
|
1861
|
+
range: "min",
|
1862
|
+
animate: true,
|
1863
|
+
orientation: "vertical"
|
1864
|
+
});
|
1865
|
+
});
|
1866
|
+
}
|
1867
|
+
/*-------------------------------------------
|
1868
|
+
Function for jQuery-UI page (ui_jquery-ui.html)
|
1869
|
+
---------------------------------------------*/
|
1870
|
+
//
|
1871
|
+
// Function for make all Date-Time pickers on page
|
1872
|
+
//
|
1873
|
+
function AllTimePickers(){
|
1874
|
+
$('#datetime_example').datetimepicker({});
|
1875
|
+
$('#time_example').timepicker({
|
1876
|
+
hourGrid: 4,
|
1877
|
+
minuteGrid: 10,
|
1878
|
+
timeFormat: 'hh:mm tt'
|
1879
|
+
});
|
1880
|
+
$('#date3_example').datepicker({ numberOfMonths: 3, showButtonPanel: true});
|
1881
|
+
$('#date3-1_example').datepicker({ numberOfMonths: 3, showButtonPanel: true});
|
1882
|
+
$('#date_example').datepicker({});
|
1883
|
+
}
|
1884
|
+
/*-------------------------------------------
|
1885
|
+
Function for Calendar page (calendar.html)
|
1886
|
+
---------------------------------------------*/
|
1887
|
+
//
|
1888
|
+
// Example form validator function
|
1889
|
+
//
|
1890
|
+
function DrawCalendar(){
|
1891
|
+
/* initialize the external events
|
1892
|
+
-----------------------------------------------------------------*/
|
1893
|
+
$('#external-events div.external-event').each(function() {
|
1894
|
+
// create an Event Object (http://arshaw.com/fullcalendar/docs/event_data/Event_Object/)
|
1895
|
+
var eventObject = {
|
1896
|
+
title: $.trim($(this).text()) // use the element's text as the event title
|
1897
|
+
};
|
1898
|
+
// store the Event Object in the DOM element so we can get to it later
|
1899
|
+
$(this).data('eventObject', eventObject);
|
1900
|
+
// make the event draggable using jQuery UI
|
1901
|
+
$(this).draggable({
|
1902
|
+
zIndex: 999,
|
1903
|
+
revert: true, // will cause the event to go back to its
|
1904
|
+
revertDuration: 0 // original position after the drag
|
1905
|
+
});
|
1906
|
+
});
|
1907
|
+
/* initialize the calendar
|
1908
|
+
-----------------------------------------------------------------*/
|
1909
|
+
var calendar = $('#calendar').fullCalendar({
|
1910
|
+
header: {
|
1911
|
+
left: 'prev,next today',
|
1912
|
+
center: 'title',
|
1913
|
+
right: 'month,agendaWeek,agendaDay'
|
1914
|
+
},
|
1915
|
+
selectable: true,
|
1916
|
+
selectHelper: true,
|
1917
|
+
select: function(start, end, allDay) {
|
1918
|
+
var form = $('<form id="event_form">'+
|
1919
|
+
'<div class="form-group has-success has-feedback">'+
|
1920
|
+
'<label">Event name</label>'+
|
1921
|
+
'<div>'+
|
1922
|
+
'<input type="text" id="newevent_name" class="form-control" placeholder="Name of event">'+
|
1923
|
+
'</div>'+
|
1924
|
+
'<label>Description</label>'+
|
1925
|
+
'<div>'+
|
1926
|
+
'<textarea rows="3" id="newevent_desc" class="form-control" placeholder="Description"></textarea>'+
|
1927
|
+
'</div>'+
|
1928
|
+
'</div>'+
|
1929
|
+
'</form>');
|
1930
|
+
var buttons = $('<button id="event_cancel" type="cancel" class="btn btn-default btn-label-left">'+
|
1931
|
+
'<span><i class="fa fa-clock-o txt-danger"></i></span>'+
|
1932
|
+
'Cancel'+
|
1933
|
+
'</button>'+
|
1934
|
+
'<button type="submit" id="event_submit" class="btn btn-primary btn-label-left pull-right">'+
|
1935
|
+
'<span><i class="fa fa-clock-o"></i></span>'+
|
1936
|
+
'Add'+
|
1937
|
+
'</button>');
|
1938
|
+
OpenModalBox('Add event', form, buttons);
|
1939
|
+
$('#event_cancel').on('click', function(){
|
1940
|
+
CloseModalBox();
|
1941
|
+
});
|
1942
|
+
$('#event_submit').on('click', function(){
|
1943
|
+
var new_event_name = $('#newevent_name').val();
|
1944
|
+
if (new_event_name != ''){
|
1945
|
+
calendar.fullCalendar('renderEvent',
|
1946
|
+
{
|
1947
|
+
title: new_event_name,
|
1948
|
+
description: $('#newevent_desc').val(),
|
1949
|
+
start: start,
|
1950
|
+
end: end,
|
1951
|
+
allDay: allDay
|
1952
|
+
},
|
1953
|
+
true // make the event "stick"
|
1954
|
+
);
|
1955
|
+
}
|
1956
|
+
CloseModalBox();
|
1957
|
+
});
|
1958
|
+
calendar.fullCalendar('unselect');
|
1959
|
+
},
|
1960
|
+
editable: true,
|
1961
|
+
droppable: true, // this allows things to be dropped onto the calendar !!!
|
1962
|
+
drop: function(date, allDay) { // this function is called when something is dropped
|
1963
|
+
// retrieve the dropped element's stored Event Object
|
1964
|
+
var originalEventObject = $(this).data('eventObject');
|
1965
|
+
// we need to copy it, so that multiple events don't have a reference to the same object
|
1966
|
+
var copiedEventObject = $.extend({}, originalEventObject);
|
1967
|
+
// assign it the date that was reported
|
1968
|
+
copiedEventObject.start = date;
|
1969
|
+
copiedEventObject.allDay = allDay;
|
1970
|
+
// render the event on the calendar
|
1971
|
+
// the last `true` argument determines if the event "sticks" (http://arshaw.com/fullcalendar/docs/event_rendering/renderEvent/)
|
1972
|
+
$('#calendar').fullCalendar('renderEvent', copiedEventObject, true);
|
1973
|
+
// is the "remove after drop" checkbox checked?
|
1974
|
+
if ($('#drop-remove').is(':checked')) {
|
1975
|
+
// if so, remove the element from the "Draggable Events" list
|
1976
|
+
$(this).remove();
|
1977
|
+
}
|
1978
|
+
},
|
1979
|
+
eventRender: function (event, element, icon) {
|
1980
|
+
if (event.description != "") {
|
1981
|
+
element.attr('title', event.description);
|
1982
|
+
}
|
1983
|
+
},
|
1984
|
+
eventClick: function(calEvent, jsEvent, view) {
|
1985
|
+
var form = $('<form id="event_form">'+
|
1986
|
+
'<div class="form-group has-success has-feedback">'+
|
1987
|
+
'<label">Event name</label>'+
|
1988
|
+
'<div>'+
|
1989
|
+
'<input type="text" id="newevent_name" value="'+ calEvent.title +'" class="form-control" placeholder="Name of event">'+
|
1990
|
+
'</div>'+
|
1991
|
+
'<label>Description</label>'+
|
1992
|
+
'<div>'+
|
1993
|
+
'<textarea rows="3" id="newevent_desc" class="form-control" placeholder="Description">'+ calEvent.description +'</textarea>'+
|
1994
|
+
'</div>'+
|
1995
|
+
'</div>'+
|
1996
|
+
'</form>');
|
1997
|
+
var buttons = $('<button id="event_cancel" type="cancel" class="btn btn-default btn-label-left">'+
|
1998
|
+
'<span><i class="fa fa-clock-o txt-danger"></i></span>'+
|
1999
|
+
'Cancel'+
|
2000
|
+
'</button>'+
|
2001
|
+
'<button id="event_delete" type="cancel" class="btn btn-danger btn-label-left">'+
|
2002
|
+
'<span><i class="fa fa-clock-o txt-danger"></i></span>'+
|
2003
|
+
'Delete'+
|
2004
|
+
'</button>'+
|
2005
|
+
'<button type="submit" id="event_change" class="btn btn-primary btn-label-left pull-right">'+
|
2006
|
+
'<span><i class="fa fa-clock-o"></i></span>'+
|
2007
|
+
'Save changes'+
|
2008
|
+
'</button>');
|
2009
|
+
OpenModalBox('Change event', form, buttons);
|
2010
|
+
$('#event_cancel').on('click', function(){
|
2011
|
+
CloseModalBox();
|
2012
|
+
});
|
2013
|
+
$('#event_delete').on('click', function(){
|
2014
|
+
calendar.fullCalendar('removeEvents' , function(ev){
|
2015
|
+
return (ev._id == calEvent._id);
|
2016
|
+
});
|
2017
|
+
CloseModalBox();
|
2018
|
+
});
|
2019
|
+
$('#event_change').on('click', function(){
|
2020
|
+
calEvent.title = $('#newevent_name').val();
|
2021
|
+
calEvent.description = $('#newevent_desc').val();
|
2022
|
+
calendar.fullCalendar('updateEvent', calEvent);
|
2023
|
+
CloseModalBox()
|
2024
|
+
});
|
2025
|
+
}
|
2026
|
+
});
|
2027
|
+
$('#new-event-add').on('click', function(event){
|
2028
|
+
event.preventDefault();
|
2029
|
+
var event_name = $('#new-event-title').val();
|
2030
|
+
var event_description = $('#new-event-desc').val();
|
2031
|
+
if (event_name != ''){
|
2032
|
+
var event_template = $('<div class="external-event" data-description="'+event_description+'">'+event_name+'</div>');
|
2033
|
+
$('#events-templates-header').after(event_template);
|
2034
|
+
var eventObject = {
|
2035
|
+
title: event_name,
|
2036
|
+
description: event_description
|
2037
|
+
};
|
2038
|
+
// store the Event Object in the DOM element so we can get to it later
|
2039
|
+
event_template.data('eventObject', eventObject);
|
2040
|
+
event_template.draggable({
|
2041
|
+
zIndex: 999,
|
2042
|
+
revert: true,
|
2043
|
+
revertDuration: 0
|
2044
|
+
});
|
2045
|
+
}
|
2046
|
+
});
|
2047
|
+
}
|
2048
|
+
//
|
2049
|
+
// Load scripts and draw Calendar
|
2050
|
+
//
|
2051
|
+
function DrawFullCalendar(){
|
2052
|
+
LoadCalendarScript(DrawCalendar);
|
2053
|
+
}
|
2054
|
+
//////////////////////////////////////////////////////
|
2055
|
+
//////////////////////////////////////////////////////
|
2056
|
+
//
|
2057
|
+
// MAIN DOCUMENT READY SCRIPT OF DEVOOPS THEME
|
2058
|
+
//
|
2059
|
+
// In this script main logic of theme
|
2060
|
+
//
|
2061
|
+
//////////////////////////////////////////////////////
|
2062
|
+
//////////////////////////////////////////////////////
|
2063
|
+
$(document).ready(function () {
|
2064
|
+
$('.show-sidebar').on('click', function () {
|
2065
|
+
$('div#main').toggleClass('sidebar-show');
|
2066
|
+
setTimeout(MessagesMenuWidth, 250);
|
2067
|
+
});
|
2068
|
+
var ajax_url = location.hash.replace(/^#/, '');
|
2069
|
+
if (ajax_url.length < 1) {
|
2070
|
+
ajax_url = 'ajax/dashboard.html';
|
2071
|
+
}
|
2072
|
+
LoadAjaxContent(ajax_url);
|
2073
|
+
$('.main-menu').on('click', 'a', function (e) {
|
2074
|
+
var parents = $(this).parents('li');
|
2075
|
+
var li = $(this).closest('li.dropdown');
|
2076
|
+
var another_items = $('.main-menu li').not(parents);
|
2077
|
+
another_items.find('a').removeClass('active');
|
2078
|
+
another_items.find('a').removeClass('active-parent');
|
2079
|
+
if ($(this).hasClass('dropdown-toggle') || $(this).closest('li').find('ul').length == 0) {
|
2080
|
+
$(this).addClass('active-parent');
|
2081
|
+
var current = $(this).next();
|
2082
|
+
if (current.is(':visible')) {
|
2083
|
+
li.find("ul.dropdown-menu").slideUp('fast');
|
2084
|
+
li.find("ul.dropdown-menu a").removeClass('active')
|
2085
|
+
}
|
2086
|
+
else {
|
2087
|
+
another_items.find("ul.dropdown-menu").slideUp('fast');
|
2088
|
+
current.slideDown('fast');
|
2089
|
+
}
|
2090
|
+
}
|
2091
|
+
else {
|
2092
|
+
if (li.find('a.dropdown-toggle').hasClass('active-parent')) {
|
2093
|
+
var pre = $(this).closest('ul.dropdown-menu');
|
2094
|
+
pre.find("li.dropdown").not($(this).closest('li')).find('ul.dropdown-menu').slideUp('fast');
|
2095
|
+
}
|
2096
|
+
}
|
2097
|
+
if ($(this).hasClass('active') == false) {
|
2098
|
+
$(this).parents("ul.dropdown-menu").find('a').removeClass('active');
|
2099
|
+
$(this).addClass('active')
|
2100
|
+
}
|
2101
|
+
if ($(this).hasClass('ajax-link')) {
|
2102
|
+
e.preventDefault();
|
2103
|
+
if ($(this).hasClass('add-full')) {
|
2104
|
+
$('#content').addClass('full-content');
|
2105
|
+
}
|
2106
|
+
else {
|
2107
|
+
$('#content').removeClass('full-content');
|
2108
|
+
}
|
2109
|
+
var url = $(this).attr('href');
|
2110
|
+
window.location.hash = url;
|
2111
|
+
LoadAjaxContent(url);
|
2112
|
+
}
|
2113
|
+
if ($(this).attr('href') == '#') {
|
2114
|
+
e.preventDefault();
|
2115
|
+
}
|
2116
|
+
});
|
2117
|
+
var height = window.innerHeight - 49;
|
2118
|
+
$('#main').css('min-height', height)
|
2119
|
+
.on('click', '.expand-link', function (e) {
|
2120
|
+
var body = $('body');
|
2121
|
+
e.preventDefault();
|
2122
|
+
var box = $(this).closest('div.box');
|
2123
|
+
var button = $(this).find('i');
|
2124
|
+
button.toggleClass('fa-expand').toggleClass('fa-compress');
|
2125
|
+
box.toggleClass('expanded');
|
2126
|
+
body.toggleClass('body-expanded');
|
2127
|
+
var timeout = 0;
|
2128
|
+
if (body.hasClass('body-expanded')) {
|
2129
|
+
timeout = 100;
|
2130
|
+
}
|
2131
|
+
setTimeout(function () {
|
2132
|
+
box.toggleClass('expanded-padding');
|
2133
|
+
}, timeout);
|
2134
|
+
setTimeout(function () {
|
2135
|
+
box.resize();
|
2136
|
+
box.find('[id^=map-]').resize();
|
2137
|
+
}, timeout + 50);
|
2138
|
+
})
|
2139
|
+
.on('click', '.collapse-link', function (e) {
|
2140
|
+
e.preventDefault();
|
2141
|
+
var box = $(this).closest('div.box');
|
2142
|
+
var button = $(this).find('i');
|
2143
|
+
var content = box.find('div.box-content');
|
2144
|
+
content.slideToggle('fast');
|
2145
|
+
button.toggleClass('fa-chevron-up').toggleClass('fa-chevron-down');
|
2146
|
+
setTimeout(function () {
|
2147
|
+
box.resize();
|
2148
|
+
box.find('[id^=map-]').resize();
|
2149
|
+
}, 50);
|
2150
|
+
})
|
2151
|
+
.on('click', '.close-link', function (e) {
|
2152
|
+
e.preventDefault();
|
2153
|
+
var content = $(this).closest('div.box');
|
2154
|
+
content.remove();
|
2155
|
+
});
|
2156
|
+
$('#locked-screen').on('click', function (e) {
|
2157
|
+
e.preventDefault();
|
2158
|
+
$('body').addClass('body-screensaver');
|
2159
|
+
$('#screensaver').addClass("show");
|
2160
|
+
ScreenSaver();
|
2161
|
+
});
|
2162
|
+
$('body').on('click', 'a.close-link', function(e){
|
2163
|
+
e.preventDefault();
|
2164
|
+
CloseModalBox();
|
2165
|
+
});
|
2166
|
+
$('#top-panel').on('click','a', function(e){
|
2167
|
+
if ($(this).hasClass('ajax-link')) {
|
2168
|
+
e.preventDefault();
|
2169
|
+
if ($(this).hasClass('add-full')) {
|
2170
|
+
$('#content').addClass('full-content');
|
2171
|
+
}
|
2172
|
+
else {
|
2173
|
+
$('#content').removeClass('full-content');
|
2174
|
+
}
|
2175
|
+
var url = $(this).attr('href');
|
2176
|
+
window.location.hash = url;
|
2177
|
+
LoadAjaxContent(url);
|
2178
|
+
}
|
2179
|
+
});
|
2180
|
+
$('#search').on('keydown', function(e){
|
2181
|
+
if (e.keyCode == 13){
|
2182
|
+
e.preventDefault();
|
2183
|
+
$('#content').removeClass('full-content');
|
2184
|
+
ajax_url = 'ajax/page_search.html';
|
2185
|
+
window.location.hash = ajax_url;
|
2186
|
+
LoadAjaxContent(ajax_url);
|
2187
|
+
}
|
2188
|
+
});
|
2189
|
+
$('#screen_unlock').on('mouseover', function(){
|
2190
|
+
var header = 'Enter current username and password';
|
2191
|
+
var form = $('<div class="form-group"><label class="control-label">Username</label><input type="text" class="form-control" name="username" /></div>'+
|
2192
|
+
'<div class="form-group"><label class="control-label">Password</label><input type="password" class="form-control" name="password" /></div>');
|
2193
|
+
var button = $('<div class="text-center"><a href="index.html" class="btn btn-primary">Unlock</a></div>');
|
2194
|
+
OpenModalBox(header, form, button);
|
2195
|
+
});
|
2196
|
+
});
|
2197
|
+
|
2198
|
+
|