jquery_cheats 5.1.1 → 5.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,64 +1,63 @@
1
1
  /*A context menu to replace the windows pop-out one.
2
- * by Travis Pessetto for ES3 inc first authored August 30, 2011
3
- * as part of the jquery_cheats gem
4
- */
2
+ * by Travis Pessetto for ES3 inc first authored August 30, 2011
3
+ * as part of the jquery_cheats gem
4
+ */
5
5
  //As of August 30, 2012 this solution is partially working. Look at bottom of page. Must work out bugs.
6
6
 
7
7
  //Global...bad...think about removing....
8
8
  click$ = null;
9
- $(document).ready(function(){
9
+ $(document).ready(function() {
10
10
  //Disable all bar charts...
11
- $("div.barchart canvas").live("contextmenu",function(e){
11
+ $("div.barchart canvas").on("contextmenu", function(e) {
12
12
  click$ = $(this).parents("div.barchart").last();
13
- $("body").append('<ul id="jqplot_context_menu"><li><a onclick="showGraphImage();">View as image</a></li></ul>');
14
- var li$ = $("#jqplot_context_menu");
15
- li$.css("display","none");
16
- li$.css("position","absolute");
17
- li$.css("top",e.pageY);
18
- li$.css("left",e.pageX);
19
- li$.fadeIn();
13
+ if($("#jqplot_context_menu").length > 0) $("#jqplot_context_menu").remove();
14
+ $("body").append('<ul id="jqplot_context_menu"><li><a onclick="showGraphImage();">View as image</a></li></ul>');
15
+ var li$ = $("#jqplot_context_menu");
16
+ li$.css("display", "none");
17
+ li$.css("position", "absolute");
18
+ li$.css("top", e.pageY);
19
+ li$.css("left", e.pageX);
20
+ li$.fadeIn();
20
21
  return false;
21
22
  });
22
-
23
- $("#psGreyScreen").live("click",function()
24
- {
25
- if($("div#canvasImage").length > 0)
26
- {
27
- $("div#canvasImage").css("display","none");
28
- $("div#canvasImage").remove();
29
- $("#psGreyScreen").fadeOut();
30
- $("#psGreyScreen").remove();
31
- }
32
- })
33
23
  });
34
24
 
35
-
36
- function showGraphImage()
37
- {
38
-
25
+ function showGraphImage() {
39
26
  $("body").prepend('<div id="psGreyScreen"></div>');
27
+ $("#psGreyScreen").on("click",closeGreyScreen);
40
28
  greyScreen$ = $("#psGreyScreen");
41
- greyScreen$.css({"background-color" : "#ccc"});
42
- greyScreen$.css("width",$("body").width());
43
- greyScreen$.css("height",$("body").height());
44
- greyScreen$.css("z-index","2999");
45
- greyScreen$.css("position","fixed");
46
- greyScreen$.css("top","0");
47
- greyScreen$.css("left","0");
29
+ greyScreen$.css({
30
+ "background-color" : "#ccc"
31
+ });
32
+ greyScreen$.css("width", $("body").width());
33
+ greyScreen$.css("height", $("body").height());
34
+ greyScreen$.css("z-index", "2999");
35
+ greyScreen$.css("position", "fixed");
36
+ greyScreen$.css("top", "0");
37
+ greyScreen$.css("left", "0");
48
38
  greyScreen$.fadeIn();
49
-
39
+
50
40
  var chart = click$;
51
41
  //centered text is bad in this situation...make sure it is left
52
- chart.css("text-align","left")
53
- var img = chart.jqplotToImageStr({});
42
+ chart.css("text-align", "left")
43
+ var img = chart.jqplotToImageStr({});
54
44
  $("jqplot_context_menu").remove();
55
- $("body").prepend('<div id="canvasImage"><img src="'+img+'" name="'+chart.attr("id")+'"/></div>');
45
+ $("body").prepend('<div id="canvasImage"><img src="' + img + '" name="' + chart.attr("id") + '"/></div>');
56
46
  ci$ = $("div#canvasImage");
57
- ci$.css("position","fixed")
58
- ci$.css("border","10px solid #000");
59
- ci$.css("background-color","#000");
60
- ci$.css("top","0");
61
- ci$.css("left",($("body").width()/2)-(ci$.width()/2));
62
- ci$.css("z-index","3000")
47
+ ci$.css("position", "fixed")
48
+ ci$.css("border", "10px solid #000");
49
+ ci$.css("background-color", "#000");
50
+ ci$.css("top", "0");
51
+ ci$.css("left", ($("body").width() / 2) - (ci$.width() / 2));
52
+ ci$.css("z-index", "3000")
63
53
  ci$.fadeIn();
64
54
  }
55
+
56
+ function closeGreyScreen() {
57
+ if($("div#canvasImage").length > 0) {
58
+ $("div#canvasImage").css("display", "none");
59
+ $("div#canvasImage").remove();
60
+ $("#psGreyScreen").fadeOut();
61
+ $("#psGreyScreen").remove();
62
+ }
63
+ }
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "jquery_cheats"
5
- s.version = "5.1.1"
5
+ s.version = "5.1.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Travis Pessettto"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jquery_cheats
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.1
4
+ version: 5.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-06 00:00:00.000000000 Z
12
+ date: 2012-09-13 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: JQuery, JQPlot graphing, and other useful items for jquery.
15
15
  email: travis@pessetto.com