NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @namespace https://openuserjs.org/users/Q_Library // @include * // @name GetAyaByNum // @description Get Aya By Number // @require https://code.jquery.com/jquery-3.4.1.min.js // @require https://gist.githubusercontent.com/BrockA/2625891/raw/9c97aa67ff9c5d56be34a55ad6c18a314e5eb548/waitForKeyElements.js // @run-at document-end // @copyright 6-09-2019, Q_Library (https://openuserjs.org/users/Q_Library) // @license MIT // @version 1.0.0 // ==/UserScript== // ==OpenUserJS== // @author Q_Library // @collaborator Q_Library // ==/OpenUserJS== (function () { function getAya(num) { num.keyup(function () { var ref = num.val().match(/{\d{1,3}:\d{1,3}}/gim)[0]; if (ref) { var s = ref.match(/\d{1,3}(?=:)/gim); var a = ref.match(/\d{1,3}(?=})/gim); $.getJSON("http://api.alquran.cloud/v1/ayah/" + s + ":" + a + "/editions/quran-simple-min", function (txt) { num.val(num.val().replace(/{\d{1,3}:\d{1,3}}/gim, "{" + txt.data[0].text + "}")); }); } }); } waitForKeyElements(":input", getAya); })();