Files
5ducky/media/ageblock.min.js
T
2022-10-06 22:04:13 +02:00

18 lines
6.2 KiB
JavaScript

/*/////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////
Author : Jordan Prybylski, JRD89
Name : AGE BLOCK
Created : SEP 5th 2011
Version : 1.0
Help File : For More information and help please read the help file
supplied with this file. If after reading the help file
you still need technical help. Please feel free to
email me via codecanyon.com
NOTICE : YOU MAY NOT USE THIS SCRIPT WITH OUT THE PROPER LICENSE/PERMISSION
///////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////*/
(function(a){a.fn.extend({ageBlock:function(b){var c={title:"Hello, one second please.",subtitle:"In order to view our awesome content we need to verify your age",button:"Let me in",age:"18",showError:false,error:"",opacity:1,process:""};var b=a.extend(c,b);return this.each(function(){function l(){return k("v_age")}function k(a){var b,c,d,e=document.cookie.split(";");for(b=0;b<e.length;b++){c=e[b].substr(0,e[b].indexOf("="));d=e[b].substr(e[b].indexOf("=")+1);c=c.replace(/^\s+|\s+$/g,"");if(c==a){return unescape(d)}}}function j(a,b,c){var d=new Date;d.setDate(d.getDate()+c);var e=escape(b)+(c==null?"":"; expires="+d.toUTCString());document.cookie=a+"="+e}function i(){for(var b=0;b<2;b++){a("#modal-container").animate({left:"33%"},30).animate({left:"35%"},30)}setTimeout(function(){if(d.showError&&d.error!=""){alert(d.error)}},800)}function h(a){var b=a[0].value;var c=a[1].value;var e=a[2].value;var f=b+"/"+c+"/"+e;var g=new Date;g.setFullYear(g.getFullYear()-d.age);return(new Date(f)).getTime()-g.getTime()<0?true:false}function g(){var a=new Date;var b=1900;var c="";now=parseInt(a.getFullYear());for(var d=now;d>b;d--){c=c+"<option>"+d+"</option>"}return c}var c=a(this);var d=b;var e=l();if(!e){a("html:not(:animated),body:not(:animated)").animate({scrollTop:0},20);var f='<div id="block-container">\n\t\t\t\t\t\t\t\t\t\t\t\t<div id="overlay"></div>\n\t\t\t\t\t\t\t\t\t\t\t\t<div id="modal-container">\n\t\t\t\t\t\t\t\t\t\t\t\t<div id="modal-inner">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<h1>'+d.title+"</h1>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<p>"+d.subtitle+'</p>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<br/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<form name="verify" id="verify" action="" method="post">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class="field">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<label>Month</label>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<select name="month">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option value="" selected="selected"></option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option>01</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option>02</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option>03</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option>04</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option>05</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option>06</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option>07</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option>08</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option>09</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option>10</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option>11</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option>12</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</select> / \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class="field">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<label>Day</label>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<select name="day">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option value="" selected="selected"></option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option>01</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option>02</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option>03</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option>04</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option>05</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option>06</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option>07</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option>08</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option>09</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option>10</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option>11</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option>12</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option>13</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option>14</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option>15</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option>16</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option>17</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option>18</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option>19</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option>20</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option>21</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option>22</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option>23</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option>24</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option>25</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option>26</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option>27</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option>28</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option>29</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option>30</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option>31</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</select> / \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class="field">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<label>Year</label>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<select name="year">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<option value="" selected="selected"></option>';f=f+g();f=f+'</select>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class="spacer"></div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<input type="submit" class="grey" value="'+d.button+'"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</form>\n\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t </div>';a("body").append(f).addClass("o-hidden");a("#overlay").css("opacity",d.opacity)}a("#verify").submit(function(b){var c=a(this).serializeArray();var e=0;for(var f in c){if(!c[f].value){e=1}}if(!e){var g=h(c);if(g){if(d.process){a.ajax({url:d.process,data:c,type:"post"})}a("#block-container").fadeOut("medium",function(){a("body").removeClass("o-hidden");j("v_age",true,30);a(this).remove()})}else{i()}}else{i()}b.preventDefault()})})}})})(jQuery)