simple_alert 1.2.2 → 1.2.3

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
- SHA1:
3
- metadata.gz: 319ccaa53ef99638c2b68da0fc99e5b618dfa053
4
- data.tar.gz: c327a5bfee20bfddc5f9886e2ffa8ff1cba08028
2
+ SHA256:
3
+ metadata.gz: c8dc57f6ccf8f1d70f5c84949166582ba922d059da5fd13ece1457e926f72a4f
4
+ data.tar.gz: a72289ffca30b9d9232db6b1f5c9ff92bf786bb4b02c3966ca7358c2c60a2b82
5
5
  SHA512:
6
- metadata.gz: 48b2d230c75b48255e6e29eac8b763f50fbb80eaafdc35a31de0c155935aeceb5c38bc7faba3b95700d058ec77058710a3287790249f7b595d5115e1fd67ce5a
7
- data.tar.gz: b13bfdb883bd240080526636826eb2f36f8606dec8b10bae87c65fc15a8083e2878265ac89e85e3c43284fdff39729055b558605f139c3facfe8a8a3fb01b94a
6
+ metadata.gz: 67b923a9049a9935b67bd8c2790bccf98264e0f04d8da6c40b2f88a2bf37eded39e44621d70d897ed6caadfa604ef76d167439754fb1d3bbb11bf621a4439089
7
+ data.tar.gz: bf55e8e79ae20cba2355074a52a7ef748d00d32a74e5eddf730a75258697ed4afaa4a65489141c7fc25d64891e33cc290d2bd7baf2b32d6f6a992978e6ac46fc
data/README.md CHANGED
@@ -13,7 +13,7 @@ gem 'simple_alert'
13
13
 
14
14
  ### Rails 4
15
15
  ```ruby
16
- gem 'simple_alert', '0.1.1'
16
+ gem 'simple_alert', '0.1.2'
17
17
  ```
18
18
 
19
19
  In application.css
@@ -99,4 +99,4 @@ Dependencies
99
99
 
100
100
  ## License
101
101
 
102
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
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.2.2"
2
+ VERSION = "1.2.3"
3
3
  end
@@ -20,4 +20,12 @@ if(!$().topZIndex){
20
20
  alert("TopZIndex is required \nAdd //= require simple_alert/top_z_index before require simple_alert on your application.js")
21
21
  }
22
22
 
23
- (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()});$(h["shadow"]).transition({opacity:0},h["closeTime"],function(){return $(this).remove()});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);
23
+ (function(){this.SimpleAlert={bt_close_class:"",bt_confirm_class:""},this.ba=function(){var o,e,n,i,t,s,c,l,d,r,a,u,m,f,v,w,_,b,h,C,p,g
24
+ return m=$.topZIndex(),f={37:1,38:1,39:1,40:1},_=function(o){o=o||window.event,o.preventDefault&&o.preventDefault(),o.returnValue=!1},b=function(o){if(f[o.keyCode])return _(o),!1},s=function(){window.addEventListener&&window.addEventListener("DOMMouseScroll",_,!1),window.onwheel=_,window.onmousewheel=document.onmousewheel=_,window.ontouchmove=_,document.onkeydown=b},c=function(){window.removeEventListener&&window.removeEventListener("DOMMouseScroll",_,!1),window.onmousewheel=document.onmousewheel=null,window.onwheel=null,window.ontouchmove=null,document.onkeydown=null},a=function(){var o
25
+ for(o=(Math.random()+"").substring(2);$("#shadow_"+o).size()>0;)o=(Math.random()+"").substring(2)
26
+ return o},h=function(o){var e,n
27
+ if(o[0].constructor===Object)e=o[0]
28
+ else switch(e={},o.length){case 1:e.message=o[0]
29
+ break
30
+ case 2:e.title=o[0],e.message=o[1]}return n={},n.title=void 0!==e.title&&e.title,n.message=void 0!==e.message&&e.message,n.showConfirmBtn=void 0!==e.showConfirmBtn||(void 0!==e.onConfirm||void 0!==e.confirmClass||void 0!==e.confirmText),n.showCloseBtn=void 0!==e.showCloseBtn,n.confirmText=void 0!==e.confirmText?e.confirmText:"Confirm",n.confirmClass=void 0!==e.confirmClass?e.confirmClass:SimpleAlert.bt_confirm_class,n.closeText=void 0!==e.closeText?e.closeText:"Close",n.closeClass=void 0!==e.closeClass?e.closeClass:SimpleAlert.bt_close_class,n.onConfirm=void 0!==e.onConfirm&&e.onConfirm,n.onClose=void 0!==e.onClose&&e.onClose,n.message=void 0!==e.message?e.message:"",n.openTime=void 0!==e.time?e.time:void 0!==e.openTime?e.openTime:250,n.closeTime=void 0!==e.time?e.time:void 0!==e.closeTime?e.closeTime:250,n.effectShow=void 0!==e.effectShow?e.effectShow:e.effect?e.effect:"easeInOutBack",n.effectHide=void 0!==e.effectHide?e.effectHide:e.effect?e.effect:"easeInBack",n.closeOnClickShadow=void 0!==e.closeOnClickShadow&&e.closeOnClickShadow,n.autoClose=void 0!==e.autoClose&&e.autoClose,n.id=e.id?e.id:a(),n.modal="#modal_"+n.id,n.shadow="#shadow_"+n.id,n.bt_close="#bt_close_"+n.id,n.div_bt_close="#div_bt_close_"+n.id,n.bt_confirm="#bt_confirm_"+n.id,n.div_bt_confirm="#div_bt_confirm_"+n.id,n},u=h(arguments),n=function(){return $(u.modal).css("marginLeft",$(u.modal).width()/2*-1+"px"),$(u.modal).css("marginTop",$(u.modal).height()/2*-1+"px"),$(u.modal).css("top","50%"),$(u.modal).css("left","50%")},g=function(){if($(u.shadow).css("zIndex",m+1),$(u.shadow).animate({opacity:"0.4"},u.openTime,function(){return s()}),u.autoClose)return setTimeout(function(){if(u.autoClose)return t()},1e3*u.autoClose)},w=function(){return $(u.modal).css("zIndex",m+2),$(u.modal).transition({scale:0},0),$(u.modal).transition({scale:1},u.openTime,u.effectShow),$(u.modal).find("input:first").focus()},i=function(){if($(u.bt_close).click(function(){return t()}),u.closeOnClickShadow)return $(u.shadow).click(function(){return t()})},C=function(){var o,e
31
+ try{return o=$(u.bt_close).outerWidth(),e=$(u.bt_confirm).outerWidth(),o>e?$(u.bt_confirm).css("width",o):$(u.bt_close).css("width",e)}catch(o){o}},d=function(){return'<div id="'+u.modal.substring(1)+'" class="ba_modal" ><div class="ba_modal_content" >'},l=function(){return u.message?'<div class="ba_modal_message" >'+u.message+"</div>":""},r=function(){return u.title?'<div class="ba_modal_title">'+u.title+"</div>":""},p=function(){return'<div id="'+u.shadow.substring(1)+'" class="ba_shadow"></div>'},t=function(o){return null==o&&(o=!1),u.autoClose=!1,u.onClose&&!o&&u.onClose(),$(u.modal).transition({scale:0,opacity:0},u.closeTime,u.effectHide,function(){return $(this).remove()}),$(u.shadow).transition({opacity:0},u.closeTime,function(){return $(this).remove()}),c()},e=function(){return u.showConfirmBtn?'<div id="'+u.div_bt_confirm.substring(1)+'" class="ba_modal_bt">\n\t<input type="button" id="'+u.bt_confirm.substring(1)+'" '+(u.confirmClass?' class="'+u.confirmClass+'" ':"")+'value="'+u.confirmText+'"></input>\n\n</div>':""},o=function(){return'<div id="'+u.div_bt_close.substring(1)+'" class="ba_modal_bt">\n\t<input type="button" id="'+u.bt_close.substring(1)+'" '+(u.closeClass?' class="'+u.closeClass+'" ':"")+'value="'+u.closeText+'"></input>\n</div>'},v=d(),v+=r(),v+=l(),v+='<div class="ba_list_bt" >',v+=e(),v+=o(),v+="</div>",v+="</div></div>",$("body").append(p()),$("body").append(v),s(),C(),g(),w(),i(),u.showConfirmBtn?$(u.bt_confirm).click(function(){if(t(!0),u.onConfirm)return u.onConfirm()}):$(u.div_bt_close).css("width","100%"),n(),$(window).resize(function(){return n()})}}).call(this)
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.2.2
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thiago Feitosa
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-06-27 00:00:00.000000000 Z
11
+ date: 2019-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -99,8 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
99
  - !ruby/object:Gem::Version
100
100
  version: '0'
101
101
  requirements: []
102
- rubyforge_project:
103
- rubygems_version: 2.5.1
102
+ rubygems_version: 3.0.1
104
103
  signing_key:
105
104
  specification_version: 4
106
105
  summary: Simple Alert