Add a Bitcoin Faucet to your website.


SUBMITTED BY: godsend

DATE: Dec. 23, 2020, 11:33 a.m.

UPDATED: Feb. 12, 2021, 3:53 p.m.

FORMAT: Text only

SIZE: 14.3 kB

HITS: 980

  1. Tips or donations can be made at 1JtkSSCJ6bsxR5AZ8bJGsyvvGBBfxmtFEtFor further tips or hacks or tutorials on winning big money
  2. Contact Telegram @Passionateforcoin
  3. No charge, I accept only donations.
  4. !function(a){FormValidation.AddOn.reCaptcha2={html5Attributes:{element:"element",language:"language",message:"message",sitekey:"siteKey",theme:"theme",timeout:"timeout"},CAPTCHA_FIELD:"g-recaptcha-response",CAPTCHA_TIMEOUT:120,init:function(b,c){var d=this,e="undefined"==typeof window.reCaptchaLoaded?function(){}:window.reCaptchaLoaded;window.reCaptchaLoaded=function(){e(),grecaptcha.render(c.element,{sitekey:c.siteKey,theme:c.theme||"light",callback:function(){b.updateStatus(d.CAPTCHA_FIELD,b.STATUS_VALID),setTimeout(function(){b.updateStatus(d.CAPTCHA_FIELD,b.STATUS_INVALID)},1e3*(c.timeout||d.CAPTCHA_TIMEOUT))}}),setTimeout(function(){d._addCaptcha(b,c)},3e3)};var f="//www.google.com/recaptcha/api.js?onload=reCaptchaLoaded&render=explicit"+(c.language?"&hl="+c.language:"");if(0===a("body").find('script[src="'+f+'"]').length){var g=document.createElement("script");g.type="text/javascript",g.async=!0,g.defer=!0,g.src=f,document.getElementsByTagName("body")[0].appendChild(g)}},_addCaptcha:function(a,b){var c=this;a.getForm().formValidation("addField",c.CAPTCHA_FIELD,{excluded:!1,validators:{callback:{message:b.message,callback:function(a){return""!==a}}}})}}}(jQuery);
  5. // Ion.Sound | version 2.1.3 | https://github.com/IonDen/ion.sound
  6. var ion = ion || {}; (function (e) { var l = function (a) { a && console && (console.warn && "function" === typeof console.warn ? console.warn(a) : console.log && "function" === typeof console.log && console.log(a)) }; if (e.sound) l("ion.sound already exists!"); else if ("function" !== typeof Audio && "object" !== typeof Audio) { var g = function () { l("HTML5 Audio is not supported in this browser") }; e.sound = function () { }; e.sound.play = g; e.sound.stop = g; e.sound.destroy = g; g() } else { var f, m = /iPad|iPhone/.test(navigator.appVersion), k, d = {}, b = {}, n, h, c; m ? (f = function (a) { this.name = a.name; this.paused = this.loop = !1; this.callback = this.sound = null }, f.prototype = { init: function () { this.sound = k }, play: function (a) { a || (a = {}); a.loop ? this.paused ? this._playLoop(this.loop + 1) : this._playLoop(a.loop) : (this.loop = !1, this._play()); a.onEnded && "function" === typeof a.onEnded && (this.callback = a.onEnded) }, _play: function () { if (this.paused) this.paused = !1; else try { this.sound.currentTime = 0 } catch (a) { } this.sound.removeEventListener("ended"); this.sound.addEventListener("ended", this._ended.bind(this), !1); this.sound.src = d.path + this.name + h; this.sound.load(); this.sound.play() } }) : (f = function (a) { this.name = a.name; this.volume = d.volume || .5; this.preload = d.preload ? "auto" : "none"; this.paused = this.loop = !1; this.callback = this.sound = null; "volume" in a && (this.volume = +a.volume); "preload" in a && (this.preload = a.preload ? "auto" : "none") }, f.prototype = { init: function () { this.sound = new Audio; this.sound.src = d.path + this.name + h; this.sound.load(); this.sound.preload = this.preload; this.sound.volume = this.volume; this.sound.addEventListener("ended", this._ended.bind(this), !1) }, play: function (a) { a || (a = {}); if (a.volume || 0 === a.volume) this.volume = +a.volume, this.sound.volume = this.volume; a.loop ? this.paused ? this._playLoop(this.loop + 1) : this._playLoop(a.loop) : (this.loop = !1, this._play()); a.onEnded && "function" === typeof a.onEnded && (this.callback = a.onEnded) }, _play: function () { if (this.paused) this.paused = !1; else try { this.sound.currentTime = 0 } catch (a) { } this.sound.play() } }); f.prototype._playLoop = function (a) { "boolean" === typeof a ? (this.loop = 9999999, this._play()) : "number" === typeof a && (this.loop = a - 1, this._play()) }; f.prototype._ended = function () { 0 < this.loop && (--this.loop, this._play()); this.callback && this.callback(this.name) }; f.prototype.pause = function () { this.paused = !0; this.sound.pause() }; f.prototype.stop = function () { this.loop = !1; this.sound.pause(); try { this.sound.currentTime = 0 } catch (a) { } }; f.prototype.destroy = function () { this.stop(); this.sound.removeEventListener("ended", this._ended.bind(this), !1); this.sound.src = ""; this.sound = null }; e.sound = function (a) { d = JSON.parse(JSON.stringify(a)); d.path = d.path || ""; d.volume = d.volume || .5; d.preload = d.preload || !1; d.mix = d.mix || !0; if (n = d.sounds.length) { k = new Audio; a = k.canPlayType("audio/mpeg"); var e = k.canPlayType("audio/ogg"), g = k.canPlayType('audio/mp4; codecs="mp4a.40.2"'); m ? "probably" === a ? h = ".mp3" : "probably" === g ? h = ".aac" : "maybe" === a ? h = ".mp3" : "maybe" === g && (h = ".aac") : h = "probably" === a ? ".mp3" : "probably" === e ? ".ogg" : "maybe" === a ? ".mp3" : "maybe" === e ? ".ogg" : ".wav"; for (c = 0; c < n; c++) a = d.sounds[c], b[a.name] = new f(a), b[a.name].init() } else l("No sound-files provided!") }; e.sound.version = "2.1.3"; e.sound.play = function (a, c) { b[a] && b[a].play(c) }; e.sound.pause = function (a) { if (a && b[a]) b[a].pause(); else for (c in b) b.hasOwnProperty(c) && b[c] && b[c].pause() }; e.sound.stop = function (a) { if (a && b[a]) b[a].stop(); else for (c in b) b.hasOwnProperty(c) && b[c] && b[c].stop() }; e.sound.destroy = function (a) { if (a && b[a]) b[a].destroy(), b[a] = null; else for (c in b) b.hasOwnProperty(c) && b[c] && (b[c].destroy(), b[c] = null) } } })(ion);
  7. // Faucet view model
  8. var faucetVM = new function () {
  9. var self = this;
  10. var form = $('#ClaimForm');
  11. self.interval = 60000;
  12. self.referralURL = ko.observable('');
  13. self.balance = ko.observable(0);
  14. self.referralCount = ko.observable(0);
  15. self.referralTotal = ko.observable(0);
  16. self.alert = ko.observable(true, { persistKey: 'alert' });
  17. self.alertWhenClaimReady = ko.observable(true, { persistKey: 'alertWhenClaimReady' });
  18. self.alertAtClaimThreshold = ko.observable(false, { persistKey: 'alertAtClaimThreshold' });
  19. self.alertAtClaimThresholdAmount = ko.observable(0, { persistKey: 'alertAtClaimThresholdAmount' }).extend({ crypto: null });
  20. self.alertPageTitle = ko.observable(true, { persistKey: 'alertPageTitle' });
  21. self.alertPlaySound = ko.observable(true, { persistKey: 'alertPlaySound' });
  22. self.claimAmount = ko.observable(0);
  23. self.canClaim = ko.observable(true);
  24. self.resultHtml = ko.observable('');
  25. self.captchaType = ko.observable(0, { persistKey: 'CaptchaType' });
  26. self.alerted = false;
  27. self.currentAnimate = null;
  28. self.fp = '';
  29. self.pageTitle = document.title;
  30. self.claimedAmount = ko.observable(0);
  31. self.baseClaimedAmount = ko.observable(0);
  32. self.loyaltyBonus = ko.observable(0);
  33. self.referralBonus = ko.observable(0);
  34. self.mysteryBonus = ko.observable(0);
  35. self.validate = function () {
  36. form.formValidation('validate');
  37. return form.data('formValidation').isValid();
  38. };
  39. self.load = function (skipBind) {
  40. callAPI('faucet', 'GetFaucetSummary', self, 'Get Faucet Summary', null,
  41. function (response) {
  42. if (response.result) {
  43. ko.mapping.fromJS(response, {}, self);
  44. }
  45. self.referralDetails = ko.computed(function () {
  46. return "Your referral link is...<br/><h3>" + self.referralURL() + "</h3><br/>" +
  47. "To date you have " + self.referralCount() + " referrals and have been paid <img src='coin/logo.png' style='height:16px;margin-bottom:4px'>&nbsp;" + self.referralTotal().toFixed(8) + " in referral commission (last 30 days)";
  48. }, this);
  49. // Apply bindings
  50. ko.applyBindings(self, $('#Navigation')[0]);
  51. ko.applyBindings(self, $('#Faucet')[0]);
  52. ko.applyBindings(self, $('#ClaimModal')[0]);
  53. ko.applyBindings(self, $('#FaucetClaimModal')[0]);
  54. ko.applyBindings(self, $('#AlertSettingsModal')[0]);
  55. ko.applyBindings(self, $('#ReferModal')[0]);
  56. //Start refresh cycle
  57. self.refreshClaimSummary();
  58. }, null, null);
  59. }
  60. self.refreshClaimSummary = function () {
  61. callAPI('faucet', 'GetClaimSummary', self, 'Get claim summary', null,
  62. function (response) {
  63. if (response.result) {
  64. self.canClaim(response.canClaim);
  65. // Set up form validation
  66. $('#ClaimForm').formValidation({ framework: 'bootstrap4' });
  67. self.currentAnimate = { claimAmount: response.claimAmount };
  68. $(self.currentAnimate).animate({ claimAmount: response.nextClaimAmount }, {
  69. duration: self.interval,
  70. easing: 'linear',
  71. step: function () {
  72. self.claimAmount(this.claimAmount);
  73. var seconds = Math.round(new Date().getTime() / 1000);
  74. if (self.alerted && self.alertPageTitle() && (seconds % 2 == 0))
  75. document.title = 'READY TO CLAIM - ' + self.pageTitle;
  76. else {
  77. document.title = self.claimAmount().toFixed(self.claimAmount() >= 0.001 ? 4 : 8) + ' - ' + self.pageTitle;
  78. }
  79. if (self.alert() && !self.alerted) {
  80. var alertNow = false;
  81. if (self.canClaim() && self.alertWhenClaimReady())
  82. {
  83. if (self.alertAtClaimThreshold())
  84. {
  85. if (!isNaN(self.alertAtClaimThresholdAmount()) && self.claimAmount() >= self.alertAtClaimThresholdAmount())
  86. alertNow = true;
  87. }
  88. else
  89. alertNow = true;
  90. }
  91. else if (self.alertAtClaimThreshold()) {
  92. if (!isNaN(self.alertAtClaimThresholdAmount()) && self.claimAmount() >= self.alertAtClaimThresholdAmount())
  93. alertNow = true;
  94. }
  95. if (alertNow) {
  96. if (self.alertPageTitle()) {
  97. document.title = 'READY TO CLAIM - ' + self.pageTitle;
  98. self.alerted = true;
  99. }
  100. if (self.alertPlaySound()) {
  101. self.playAlertSound();
  102. self.alerted = true;
  103. }
  104. }
  105. }
  106. },
  107. complete: function () {
  108. self.refreshClaimSummary();
  109. }
  110. });
  111. }
  112. else {
  113. setTimeout(function () { self.refreshClaimSummary(); }, self.interval);
  114. }
  115. },
  116. function (error) {
  117. if (window.console) console.log("GetClaimSummary error: ", error);
  118. setTimeout(function () { self.refreshClaimSummary(); }, self.interval);
  119. }, null);
  120. }
  121. self.instantClaim = function () {
  122. self.submitClaim(true);
  123. }
  124. self.delayedClaim = function () {
  125. self.submitClaim(false);
  126. }
  127. self.submitClaim = function (instantClaim) {
  128. if (self.captchaType() == 1 || self.validate()) {
  129. $(self.currentAnimate).stop();
  130. $('#ClaimModal').modal('hide');
  131. var captchaResponse = grecaptcha.getResponse();
  132. if (self.captchaType() == 1)
  133. captchaResponse = $('#adcopy_challenge').val() + '|' + $('#adcopy_response').val();
  134. callAPI('faucet', 'FaucetClaim', { adBlocked: (!$('#claimAd').is(":visible")), captchaResponse: captchaResponse, instantClaim: !instantClaim, fp: self.fp, version: $('#faucetVersion').val() }, 'Faucet claim', 'Processing claim',
  135. function (response) {
  136. if (response.result) {
  137. self.balance(response.newBalance);
  138. self.resultHtml(response.resultHtml);
  139. form[0].reset();
  140. form.data('formValidation').resetForm();
  141. self.baseClaimedAmount(response.baseClaimAmount);
  142. self.loyaltyBonus(response.loyaltyBonus);
  143. self.referralBonus(response.referralBonus);
  144. self.mysteryBonus(response.mysteryBonus);
  145. self.claimedAmount(response.claimAmount);
  146. $('#FaucetClaimModal').modal('show');
  147. }
  148. else {
  149. showMessageModal('Faucet claim', response.resultHtml, response.result);
  150. }
  151. }, null,
  152. function () {
  153. grecaptcha.reset();
  154. self.refreshClaimSummary();
  155. });
  156. };
  157. }
  158. self.playAlertSound = function () {
  159. ion.sound.play("alert");
  160. }
  161. };
  162. $(document).ready(function () {
  163. //Load view models
  164. faucetVM.load();
  165. //Set up alert sound
  166. ion.sound({ sounds: [{ name: "alert", volume: 0.3 }], path: "coin/", preload: true });
  167. $('#slideIn').delay(1000).animate({ 'bottom': '35px' }, 2000);
  168. });

comments powered by Disqus