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 GetAyaBySelection
// @description Get Aya By Selection
// @require https://code.jquery.com/jquery-3.4.1.min.js
// @require https://github.com/Nycto/PicoModal/releases/download/3.0.0/picoModal-3.0.0.min.js
// @run-at document-end
// @copyright 31-07-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 () {
this.getSelection = this.getSelection || document.getSelection || function () {
if (document.selection) return document.selection.createRange().text;
};
document.onmouseup = function (e) {
e = e || event;
if (e.button || e.which) {
var ref = getSelection().toString().match(/\d{1,3}:\d{1,3}/gim)[0];
if (ref) {
$.getJSON("http://api.alquran.cloud/v1/ayah/" + ref + "/editions/quran-simple-min", function (txt) {
picoModal({
content: "<div style='direction: rtl'>{" + txt.data[0].text + "} " + txt.data[0]["surah"].name + "</div>",
}).show();
});
}
}
};
})();