simple_alert 1.0.6 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a41d5f2b4ba11b6730ae5870c9540135aca217c0
4
- data.tar.gz: abd6a395319c62b027ff6900799448ec7effb7c4
3
+ metadata.gz: 87fb90f238a22e2f81448969fc1caef6661aee8c
4
+ data.tar.gz: f1c8c61812dd17eba0662ffbbe0846e4018d222f
5
5
  SHA512:
6
- metadata.gz: 16483e03e5562fab4202698dfea702affd482cb1b380c6d66b7ad1103dae15c9ff771fa716a863af80fd59ceb667e0788b36396b2e0ffbec51eb9814420f0f08
7
- data.tar.gz: 453f2f95261b6010e357d99deb3c3d44755928e19513778390a1fda6cdedae3662c1ff975ef7d2bf04b393d0fa0e3e275de327cf91403d530ba155990576630d
6
+ metadata.gz: 0b275b2de504a57bbfca23b18f60aedc86614c3240f104f69727a721cb41e1f635703dc18558a25a5e75d317c24a15cfc04f6438a4a96f4eccc87ce537fdfa5b
7
+ data.tar.gz: 8528cfe05019af19560ecf9f9a9472ef81187c30db0fc0ae742d7a9ad93c6f7049b453afb3a06a260ab84d28d9d3f3cadd88cf323c13279436f34b2f26d63ed6
data/CHANGELOG CHANGED
@@ -1,3 +1,5 @@
1
+ v 1.0.7
2
+ - using z index
1
3
  v 1.0.6
2
4
  - update to rails 5
3
5
  v 1.0.5
data/README.md CHANGED
@@ -1,24 +1,32 @@
1
1
  # SimpleAlert
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/simple_alert`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- [demo](https://dev.thiago.pro/simple-alert)
3
+ [DEMO](https://dev.thiago.pro/simple-alert)
6
4
 
7
5
  ## Installation
8
6
 
9
7
  Add this line to your application's Gemfile:
10
8
 
9
+ ### Rails 5
11
10
  ```ruby
12
11
  gem 'simple_alert'
13
12
  ```
14
13
 
15
- And then execute:
14
+ ### Rails 4
15
+ ```ruby
16
+ gem 'simple_alert', '0.1.1'
17
+ ```
16
18
 
17
- $ bundle
19
+ In application.css
18
20
 
19
- Or install it yourself as:
21
+ ````css
22
+ *= require simple_alert
23
+ ````
20
24
 
21
- $ gem install simple_alert
25
+ In application.js
26
+
27
+ ````javascript
28
+ //= require simple_alert
29
+ ````
22
30
 
23
31
  ## Usage
24
32
 
@@ -89,17 +97,6 @@ Dependencies
89
97
  - [transit](http://ricostacruz.com/jquery.transit/)
90
98
  - [topzindex](https://code.google.com/p/topzindex/)
91
99
 
92
- ## Development
93
-
94
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
95
-
96
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
97
-
98
- ## Contributing
99
-
100
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/simple_alert. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
101
-
102
-
103
100
  ## License
104
101
 
105
102
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -1,3 +1,3 @@
1
1
  module SimpleAlert
2
- VERSION = "1.0.6"
2
+ VERSION = "1.0.7"
3
3
  end
@@ -0,0 +1,27 @@
1
+ if(!$().transition ){
2
+ var transit = document.createElement('script');
3
+ transit.src = './assets/simple_alert/dependences/transit/transit.js';
4
+ document.head.appendChild(transit);
5
+ }
6
+ if(!"".include){
7
+ var transit = document.createElement('script');
8
+ transit.src = './assets/simple_alert/dependences/core/string.js';
9
+ document.head.appendChild(transit);
10
+ }
11
+ if(typeof ElementQueries == 'undefined'){
12
+ var transit = document.createElement('script');
13
+ transit.src = './assets/simple_alert/dependences/event_resize/ElementQueries.js';
14
+ document.head.appendChild(transit);
15
+ }
16
+ if(typeof ResizeSensor == 'undefined'){
17
+ var transit = document.createElement('script');
18
+ transit.src = './assets/simple_alert/dependences/event_resize/ResizeSensor.js';
19
+ document.head.appendChild(transit);
20
+ }
21
+ if(!$().topZIndex){
22
+ var transit = document.createElement('script');
23
+ transit.src = './assets/simple_alert/dependences/top_z_index/topZIndex.js';
24
+ document.head.appendChild(transit);
25
+ }
26
+ (function(){this.SimpleAlert={bt_close_class:"",bt_confirm_class:""};this.ba=function(){var bt_close,bt_confirm,center,close_btn_bind,close_modal,disableScroll,enableScroll,gen_message,gen_modal,gen_title,generate_random_id,h,index,keys,modal,open_modal,preventDefault,preventDefaultForScrollKeys,process_hash,resize_btns,shadow,show_shadow;index=$.topZIndex();keys={37:1,38:1,39:1,40:1};preventDefault=function(e){e=e||window.event;if(e.preventDefault){e.preventDefault()}e.returnValue=false};preventDefaultForScrollKeys=function(e){if(keys[e.keyCode]){preventDefault(e);return false}};disableScroll=function(){if(window.addEventListener){window.addEventListener("DOMMouseScroll",preventDefault,false)}window.onwheel=preventDefault;window.onmousewheel=document.onmousewheel=preventDefault;window.ontouchmove=preventDefault;document.onkeydown=preventDefaultForScrollKeys};enableScroll=function(){if(window.removeEventListener){window.removeEventListener("DOMMouseScroll",preventDefault,false)}window.onmousewheel=document.onmousewheel=null;window.onwheel=null;window.ontouchmove=null;document.onkeydown=null};generate_random_id=function(){var rr;rr=(Math.random()+"").substring(2);while($("#shadow_"+rr).size()>0){rr=(Math.random()+"").substring(2)}return rr};process_hash=function(params){var hash,r;if(params[0].constructor===Object){hash=params[0]}else{hash={};switch(params.length){case 1:hash["message"]=params[0];break;case 2:hash["title"]=params[0];hash["message"]=params[1]}}r={};r["title"]=hash["title"]!==void 0?hash["title"]:false;r["message"]=hash["message"]!==void 0?hash["message"]:false;r["showConfirmBtn"]=hash["showConfirmBtn"]!==void 0?true:hash["onConfirm"]!==void 0||(hash["confirmClass"]!==void 0||hash["confirmText"]!==void 0)?true:false;r["showCloseBtn"]=hash["showCloseBtn"]!==void 0?true:false;r["confirmText"]=hash["confirmText"]!==void 0?hash["confirmText"]:"Confirm";r["confirmClass"]=hash["confirmClass"]!==void 0?hash["confirmClass"]:SimpleAlert.bt_confirm_class;r["closeText"]=hash["closeText"]!==void 0?hash["closeText"]:"Close";r["closeClass"]=hash["closeClass"]!==void 0?hash["closeClass"]:SimpleAlert.bt_close_class;r["onConfirm"]=hash["onConfirm"]!==void 0?hash["onConfirm"]:false;r["onClose"]=hash["onClose"]!==void 0?hash["onClose"]:false;r["message"]=hash["message"]!==void 0?hash["message"]:"";r["openTime"]=hash["time"]!==void 0?hash["time"]:hash["openTime"]!==void 0?hash["openTime"]:250;r["closeTime"]=hash["time"]!==void 0?hash["time"]:hash["closeTime"]!==void 0?hash["closeTime"]:250;r["effectShow"]=hash["effectShow"]!==void 0?hash["effectShow"]:hash["effect"]?hash["effect"]:"easeInOutBack";r["effectHide"]=hash["effectHide"]!==void 0?hash["effectHide"]:hash["effect"]?hash["effect"]:"easeInBack";r["closeOnClickShadow"]=hash["closeOnClickShadow"]!==void 0?hash["closeOnClickShadow"]:false;r["autoClose"]=hash["autoClose"]!==void 0?hash["autoClose"]:false;r["id"]=hash["id"]?hash["id"]:generate_random_id();r["modal"]="#modal_"+r["id"];r["shadow"]="#shadow_"+r["id"];r["bt_close"]="#bt_close_"+r["id"];r["div_bt_close"]="#div_bt_close_"+r["id"];r["bt_confirm"]="#bt_confirm_"+r["id"];r["div_bt_confirm"]="#div_bt_confirm_"+r["id"];return r};h=process_hash(arguments);center=function(){$(h["modal"]).css("marginLeft",$(h["modal"]).width()/2*-1+"px");$(h["modal"]).css("marginTop",$(h["modal"]).height()/2*-1+"px");$(h["modal"]).css("top","50%");return $(h["modal"]).css("left","50%")};show_shadow=function(){$(h["shadow"]).css("zIndex",index+1);$(h["shadow"]).animate({opacity:"0.4"},h["openTime"],function(){return disableScroll()});if(h["autoClose"]){return setTimeout(function(){if(h["autoClose"]){return close_modal()}},h["autoClose"]*1e3)}};open_modal=function(){$(h["modal"]).css("zIndex",index+2);$(h["modal"]).transition({scale:0},0);return $(h["modal"]).transition({scale:1},h["openTime"],h["effectShow"])};close_btn_bind=function(){$(h["bt_close"]).click(function(){return close_modal()});if(h["closeOnClickShadow"]){return $(h["shadow"]).click(function(){return close_modal()})}};resize_btns=function(){var close,confirm,err,error;try{close=$(h["bt_close"]).outerWidth();confirm=$(h["bt_confirm"]).outerWidth();if(close>confirm){return $(h["bt_confirm"]).css("width",close)}else{return $(h["bt_close"]).css("width",confirm)}}catch(error){err=error}};gen_modal=function(){return'<div id="'+h["modal"].substring(1)+'" class="ba_modal" ><div class="ba_modal_content" >'};gen_message=function(){if(h["message"]){return'<div class="ba_modal_message" >'+h["message"]+"</div>"}else{return""}};gen_title=function(){if(h["title"]){return'<div class="ba_modal_title">'+h["title"]+"</div>"}else{return""}};shadow=function(){return'<div id="'+h["shadow"].substring(1)+'" class="ba_shadow"></div>'};close_modal=function(confirm){if(confirm==null){confirm=false}h["autoClose"]=false;if(h["onClose"]&&!confirm){h["onClose"]()}$(h["modal"]).transition({scale:0,opacity:0},h["closeTime"],h["effectHide"],function(){return $(this).remove()});return $(h["shadow"]).transition({opacity:0},h["closeTime"],function(){$(this).remove();if(!(h["onClose"]+"").include("ba")||!(h["onConfirm"]+"").include("ba")){return enableScroll()}})};bt_confirm=function(){if(h["showConfirmBtn"]){return'<div id="'+h["div_bt_confirm"].substring(1)+'" class="ba_modal_bt">\n <input type="button" id="'+h["bt_confirm"].substring(1)+'" '+(h["confirmClass"]?' class="'+h["confirmClass"]+'" ':"")+('value="'+h["confirmText"]+'"></input>\n\n</div>')}else{return""}};bt_close=function(){return'<div id="'+h["div_bt_close"].substring(1)+'" class="ba_modal_bt">\n <input type="button" id="'+h["bt_close"].substring(1)+'" '+(h["closeClass"]?' class="'+h["closeClass"]+'" ':"")+('value="'+h["closeText"]+'"></input>\n</div>')};modal=gen_modal();modal+=gen_title();modal+=gen_message();modal+='<div class="ba_list_bt" >';modal+=bt_confirm();modal+=bt_close();modal+="</div>";modal+="</div></div>";$("body").append(shadow());$("body").append(modal);disableScroll();resize_btns();show_shadow();open_modal();close_btn_bind();if(h["showConfirmBtn"]){$(h["bt_confirm"]).click(function(){close_modal(true);if(h["onConfirm"]){return h["onConfirm"]()}})}else{$(h["div_bt_close"]).css("width","100%")}center();return $(window).resize(function(){return center()})}}).call(this);
27
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_alert
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thiago Feitosa
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-08-12 00:00:00.000000000 Z
11
+ date: 2016-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -73,13 +73,13 @@ files:
73
73
  - lib/simple_alert.rb
74
74
  - lib/simple_alert/version.rb
75
75
  - simple_alert.gemspec
76
- - vendor/assets/javascripts/simple_alert/dependences/core/string.js
77
- - vendor/assets/javascripts/simple_alert/dependences/event_resize/ElementQueries.js
78
- - vendor/assets/javascripts/simple_alert/dependences/event_resize/ResizeSensor.js
79
- - vendor/assets/javascripts/simple_alert/dependences/top_z_index/topZIndex.js
80
- - vendor/assets/javascripts/simple_alert/dependences/transit/transit.js
81
- - vendor/assets/javascripts/simple_alert/simple_alert.js
82
- - vendor/assets/stylesheets/simple_alert/simple_alert.css
76
+ - vendor/assets/javascripts/dependences/core/string.js
77
+ - vendor/assets/javascripts/dependences/event_resize/ElementQueries.js
78
+ - vendor/assets/javascripts/dependences/event_resize/ResizeSensor.js
79
+ - vendor/assets/javascripts/dependences/top_z_index/topZIndex.js
80
+ - vendor/assets/javascripts/dependences/transit/transit.js
81
+ - vendor/assets/javascripts/simple_alert.js
82
+ - vendor/assets/stylesheets/simple_alert.css
83
83
  homepage: https://dev.thiago.pro/simple-alert
84
84
  licenses:
85
85
  - MIT
@@ -100,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  version: '0'
101
101
  requirements: []
102
102
  rubyforge_project:
103
- rubygems_version: 2.4.8
103
+ rubygems_version: 2.5.1
104
104
  signing_key:
105
105
  specification_version: 4
106
106
  summary: Simple Alert
@@ -1,26 +0,0 @@
1
- if(!$().transition ){
2
- var transit = document.createElement('script');
3
- transit.src = './assets/simple_alert/dependences/transit/transit.js';
4
- document.head.appendChild(transit);
5
- }
6
- if(!"".include){
7
- var transit = document.createElement('script');
8
- transit.src = './assets/simple_alert/dependences/core/string.js';
9
- document.head.appendChild(transit);
10
- }
11
- if(typeof ElementQueries == 'undefined'){
12
- var transit = document.createElement('script');
13
- transit.src = './assets/simple_alert/dependences/event_resize/ElementQueries.js';
14
- document.head.appendChild(transit);
15
- }
16
- if(typeof ResizeSensor == 'undefined'){
17
- var transit = document.createElement('script');
18
- transit.src = './assets/simple_alert/dependences/event_resize/ResizeSensor.js';
19
- document.head.appendChild(transit);
20
- }
21
- if(!$().topZIndex){
22
- var transit = document.createElement('script');
23
- transit.src = './assets/simple_alert/dependences/top_z_index/topZIndex.js';
24
- document.head.appendChild(transit);
25
- }
26
- (function(){this.SimpleAlert={bt_close_class:"",bt_confirm_class:""};this.ba=function(){var bt_close,bt_confirm,center,close_btn_bind,close_modal,disableScroll,enableScroll,gen_message,gen_modal,gen_title,generate_random_id,h,keys,modal,open_modal,preventDefault,preventDefaultForScrollKeys,process_hash,resize_btns,shadow,show_shadow;keys={37:1,38:1,39:1,40:1};preventDefault=function(e){e=e||window.event;if(e.preventDefault){e.preventDefault()}e.returnValue=false};preventDefaultForScrollKeys=function(e){if(keys[e.keyCode]){preventDefault(e);return false}};disableScroll=function(){if(window.addEventListener){window.addEventListener("DOMMouseScroll",preventDefault,false)}window.onwheel=preventDefault;window.onmousewheel=document.onmousewheel=preventDefault;window.ontouchmove=preventDefault;document.onkeydown=preventDefaultForScrollKeys};enableScroll=function(){if(window.removeEventListener){window.removeEventListener("DOMMouseScroll",preventDefault,false)}window.onmousewheel=document.onmousewheel=null;window.onwheel=null;window.ontouchmove=null;document.onkeydown=null};generate_random_id=function(){var rr;rr=(Math.random()+"").substring(2);while($("#shadow_"+rr).size()>0){rr=(Math.random()+"").substring(2)}return rr};process_hash=function(params){var hash,r;if(params[0].constructor===Object){hash=params[0]}else{hash={};switch(params.length){case 1:hash["message"]=params[0];break;case 2:hash["title"]=params[0];hash["message"]=params[1]}}r={};r["title"]=hash["title"]!==void 0?hash["title"]:false;r["message"]=hash["message"]!==void 0?hash["message"]:false;r["showConfirmBtn"]=hash["showConfirmBtn"]!==void 0?true:hash["onConfirm"]!==void 0||(hash["confirmClass"]!==void 0||hash["confirmText"]!==void 0)?true:false;r["showCloseBtn"]=hash["showCloseBtn"]!==void 0?true:false;r["confirmText"]=hash["confirmText"]!==void 0?hash["confirmText"]:"Confirm";r["confirmClass"]=hash["confirmClass"]!==void 0?hash["confirmClass"]:SimpleAlert.bt_confirm_class;r["closeText"]=hash["closeText"]!==void 0?hash["closeText"]:"Close";r["closeClass"]=hash["closeClass"]!==void 0?hash["closeClass"]:SimpleAlert.bt_close_class;r["onConfirm"]=hash["onConfirm"]!==void 0?hash["onConfirm"]:false;r["onClose"]=hash["onClose"]!==void 0?hash["onClose"]:false;r["message"]=hash["message"]!==void 0?hash["message"]:"";r["openTime"]=hash["time"]!==void 0?hash["time"]:hash["openTime"]!==void 0?hash["openTime"]:250;r["closeTime"]=hash["time"]!==void 0?hash["time"]:hash["closeTime"]!==void 0?hash["closeTime"]:250;r["effectShow"]=hash["effectShow"]!==void 0?hash["effectShow"]:hash["effect"]?hash["effect"]:"easeInOutBack";r["effectHide"]=hash["effectHide"]!==void 0?hash["effectHide"]:hash["effect"]?hash["effect"]:"easeInBack";r["closeOnClickShadow"]=hash["closeOnClickShadow"]!==void 0?hash["closeOnClickShadow"]:false;r["autoClose"]=hash["autoClose"]!==void 0?hash["autoClose"]:false;r["id"]=hash["id"]?hash["id"]:generate_random_id();r["modal"]="#modal_"+r["id"];r["shadow"]="#shadow_"+r["id"];r["bt_close"]="#bt_close_"+r["id"];r["div_bt_close"]="#div_bt_close_"+r["id"];r["bt_confirm"]="#bt_confirm_"+r["id"];r["div_bt_confirm"]="#div_bt_confirm_"+r["id"];return r};h=process_hash(arguments);center=function(){$(h["modal"]).css("marginLeft",$(h["modal"]).width()/2*-1+"px");$(h["modal"]).css("marginTop",$(h["modal"]).height()/2*-1+"px");$(h["modal"]).css("top","50%");return $(h["modal"]).css("left","50%")};show_shadow=function(){$(h["shadow"]).animate({opacity:"0.4"},h["openTime"],function(){return disableScroll()});if(h["autoClose"]){return setTimeout(function(){if(h["autoClose"]){return close_modal()}},h["autoClose"]*1e3)}};open_modal=function(){$(h["modal"]).transition({scale:0},0);return $(h["modal"]).transition({scale:1},h["openTime"],h["effectShow"])};close_btn_bind=function(){$(h["bt_close"]).click(function(){return close_modal()});if(h["closeOnClickShadow"]){return $(h["shadow"]).click(function(){return close_modal()})}};resize_btns=function(){var close,confirm,err,error;try{close=$(h["bt_close"]).outerWidth();confirm=$(h["bt_confirm"]).outerWidth();if(close>confirm){return $(h["bt_confirm"]).css("width",close)}else{return $(h["bt_close"]).css("width",confirm)}}catch(error){err=error}};gen_modal=function(){return'<div id="'+h["modal"].substring(1)+'" class="ba_modal" ><div class="ba_modal_content" >'};gen_message=function(){if(h["message"]){return'<div class="ba_modal_message" >'+h["message"]+"</div>"}else{return""}};gen_title=function(){if(h["title"]){return'<div class="ba_modal_title">'+h["title"]+"</div>"}else{return""}};shadow=function(){return'<div id="'+h["shadow"].substring(1)+'" class="ba_shadow"></div>'};close_modal=function(confirm){if(confirm==null){confirm=false}h["autoClose"]=false;if(h["onClose"]&&!confirm){h["onClose"]()}$(h["modal"]).transition({scale:0,opacity:0},h["closeTime"],h["effectHide"],function(){return $(this).remove()});return $(h["shadow"]).transition({opacity:0},h["closeTime"],function(){$(this).remove();if(!(h["onClose"]+"").include("ba")||!(h["onConfirm"]+"").include("ba")){return enableScroll()}})};bt_confirm=function(){if(h["showConfirmBtn"]){return'<div id="'+h["div_bt_confirm"].substring(1)+'" class="ba_modal_bt">\n\t<input type="button" id="'+h["bt_confirm"].substring(1)+'" '+(h["confirmClass"]?' class="'+h["confirmClass"]+'" ':"")+('value="'+h["confirmText"]+'"></input>\n\n</div>')}else{return""}};bt_close=function(){return'<div id="'+h["div_bt_close"].substring(1)+'" class="ba_modal_bt">\n\t<input type="button" id="'+h["bt_close"].substring(1)+'" '+(h["closeClass"]?' class="'+h["closeClass"]+'" ':"")+('value="'+h["closeText"]+'"></input>\n</div>')};modal=gen_modal();modal+=gen_title();modal+=gen_message();modal+='<div class="ba_list_bt" >';modal+=bt_confirm();modal+=bt_close();modal+="</div>";modal+="</div></div>";$("body").append(shadow());$("body").append(modal);disableScroll();resize_btns();show_shadow();open_modal();close_btn_bind();if(h["showConfirmBtn"]){$(h["bt_confirm"]).click(function(){close_modal(true);if(h["onConfirm"]){return h["onConfirm"]()}})}else{$(h["div_bt_close"]).css("width","100%")}center();return $(window).resize(function(){return center()})}}).call(this);