qzaidi / quran

node,websql and javascript API for Holy quran
qzaidi.github.io/quran/
Creative Commons Attribution 4.0 International
123 stars 36 forks source link

is it possible to pass multiple references at once? #13

Open halukkaramete opened 5 years ago

halukkaramete commented 5 years ago

Selams

To paint an arbitrary sequence of verses, say the search results of a word search, what do we need to do? Following shows 5 verses with one script call:

<div id='verses2'></div>
    <div id='translation'></div>
    <script 
      chapter=93 verse=6 count=5 selector='#verses2' trans='#translation'
      src="http://qzaidi.github.io/quran/js/quran.js">
    </script>

however, what if you want to display, say 36:1 55:3 45:3? Do I need 3 similar snippets? If I need to

SRC'ing the "http://qzaidi.github.io/quran/js/quran.js" more than 1 time does not make sense to me. Could you tell me it is totally OK to do so?

Or, Is there a way to pass something like this ( ids="36:1,55:3,45:3" ) as demonstrated below?

<div id='verses2'></div>
    <div id='translation'></div>
    <script 
      **ids="36:1,55:3,45:3"** selector='#verses2' trans='#translation'
      src="http://qzaidi.github.io/quran/js/quran.js">
    </script>
qzaidi commented 5 years ago

If you are doing this in a modern browser, including it more than once would not be an issue since the file will only be fetched once (it has correct cache headers). You can see this behavior on this page https://qzaidi.github.io/2013/10/05/quranjs/

It is also possible to support multiple values in a single call though - I would have a look at this next weekend to see how complex it is.

halukkaramete commented 5 years ago

Thank you for your reply. I may end up using this at IslamiCity on our new Quran Search Module - with proper credit. But I will have to change a few things. One thing I'd surely enable is that the users must be able to download the data ( the Arabic script, the trans of their choice etc.. ) to their browser's local storage so when they ask for chap this verse that, or our search routine is about to display a whole bunch of verses, the script and translations are all pulled from the local storage thru json arrays and not rely on google at all.

I have to really study how you did what you did line by line and change it to support multiple translations. Then this will serve millions every year inA.

Send me your email pls thru https://www.islamicity.org/feedback/ if you wish... Would you?

On Mon, Jul 22, 2019 at 8:57 AM Qasim Zaidi notifications@github.com wrote:

If you are doing this in a modern browser, including it more than once would not be an issue since the file will only be fetched once (it has correct cache headers). You can see this behavior on this page https://qzaidi.github.io/2013/10/05/quranjs/

It is also possible to support multiple values in a single call though - I would have a look at this next weekend to see how complex it is.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/qzaidi/quran/issues/13?email_source=notifications&email_token=AA6X2J4IIP3GUJJUWWNR3LTQAVD3HA5CNFSM4IFRUSH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2O3EOY#issuecomment-513651259, or mute the thread https://github.com/notifications/unsubscribe-auth/AA6X2J7G6DSXSTPHV5O5AMLQAVD3HANCNFSM4IFRUSHQ .