Skip to content

Instantly share code, notes, and snippets.

@ism33ail
Last active April 29, 2020 00:52
Show Gist options
  • Save ism33ail/5ff5765deb740c0ddbc85df59c86094f to your computer and use it in GitHub Desktop.
Save ism33ail/5ff5765deb740c0ddbc85df59c86094f to your computer and use it in GitHub Desktop.
function loadCom(a,b) {
setTimeout(function() {
$(a).fadeIn(250);
}, b);
}
$.fn.onEnterKey = function(callback) {
$(this).keypress(function(event) {
var code = event.keyCode ? event.keyCode : event.which;
if (code == 13) {
callback();
return false;
}
});
}
function loadAllComment(){
loadCom('#com1', 3250);
loadCom('#com2', 5800);
loadCom('#com3', 5700);
loadCom('#com4', 7500);
loadCom('#com5', 9000);
}
$(document).ready(function() {
loadAllComment();
$('.like').on('click',function() {
var _this = $(this);
if(_this.hasClass('active-like')) {
_this.removeClass('active-like');
$('.you').removeClass('activee');
} else {
_this.addClass('active-like');
$('.you').addClass('activee');
}
});
$(document).on('click', '.fblike', function() {
var _this = $(this);
var x = _this.next().next().html() == '' ? 0 : parseInt(_this.next().next().html());
if(_this.hasClass('selected')) {
_this.removeClass('selected').html('Like');
_this.next().next().html(--x);
if(x == 0) _this.next().next().addClass('likehide');
} else {
_this.addClass('selected').html('إزالة الإعجاب');
_this.next().next().html(++x);
if(_this.next().next().hasClass('likehide')) _this.next().next().removeClass('likehide');
}
});
$("#addCom").onEnterKey(function() {
var value = $("#addCom").val();
$("#addCom").val("");
$("#myComment").html(value);
$(".addComment").hide();
loadCom('#myCom', 250);
});
var teilen = 10;
var pruefen = 0;
//3 Fragen und Pruefung
$("#frage_01").click(function() {
show('#frage_02');
hide('#frage_01');
});
$("#frage_02").click(function() {
show('#frage_03');
hide('#frage_02');
});
$("#frage_03").click(function() {
show('#frage_04');
hide('#frage_03');
});
$("#frage_04 button").click(function() {
show('#content_02');
hide('#frage_04');
hide('#aufforderung');
var myTimer1 = window.setInterval(updateTimer1, 2000);
function updateTimer1() {
pruefen++;
$("#check").text(pruefen);
if ( pruefen == 1 ) {
show('#pruefen_01');
}
if ( pruefen == 2 ) {
show('#pruefen_02');
}
if ( pruefen == 3 ) {
show('#pruefen_03');
}
if ( pruefen == 4 ) {
window.clearInterval(myTimer1);
show('#content_03');
hide('#content_02');
hide('#intro');
}
}
});
$("#btnShare1").click(function() {
teilen--;
$('#anzahl').text( teilen );
if (teilen == 0) {
show('#btnWin');
hide('#btnFakeWin');
}
});
$("#btnShare2").click(function() {
teilen--;
$('#anzahl').text( teilen );
if (teilen == 0) {
show('#btnWin');
hide('#btnFakeWin');
}
});
$("#btnFakeWin").click(function() {
alert ('Please share it with ' + Share + ' Other Contacts!');
});
function show (toBlock){
//setDisplay(toBlock, 'block');
$(toBlock).show();
}
function hide (toNone) {
//setDisplay(toNone, 'none');
$(toNone).hide();
}
function setDisplay (target, str) {
document.getElementById(target).style.display = str;
}
var zeit = new Date();
var sec = zeit.getSeconds();
if (sec < 6 ){
sec = 9;
}
if (sec > 5 & sec < 13 ){
sec = 8;
}
if (sec > 11 & sec < 19 ){
sec = 7;
}
if (sec > 17 & sec < 25 ){
sec = 6
}
if (sec > 23 & sec < 31 ){
sec = 5
}
if (sec > 29 & sec < 37 ){
sec = 4
}
if (sec > 35 & sec < 43 ){
sec = 3
}
if (sec > 41 & sec < 49 ){
sec = 2
}
if (sec > 47 & sec < 55 ){
sec = 1
}
if (sec > 54){
sec=0
};
var add = sec;
var zeit2 = new Date();
var minute = zeit2.getMinutes();
var timer1 = (60-minute)*60;
if (timer1 > 1800) {
var resttimer = (30-minute)*10
} else {
var resttimer = (60-minute)*10
};
var timer = resttimer + add + 67;
function updateTimer() {
timer--;
$("#gutschein").text(timer);
if (timer < 9) {
stopFunction();
}
}
var myTimer = window.setInterval(updateTimer, 6000);
function stopFunction() {
window.clearInterval(myTimer);
}
});
var c = 0;
$(document).ready(function () {
$("#b1")
.on('click', function () {
++c;
if (c > 15) { $(this)
.attr({ href: "final.html", target: "_self" }); } });
$("#b2")
.on('click', function () { if (c > 15) window.location = "final.html";
else window.alert("المرجو إرسال كود على الأقل 30 مرة، ليتم تقديم لك كود التتبع !\n\n المشاركات المحتملة التي قمت بها لحد الآن هي " + c);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment