+ 1

How to import Js libraries into SL playground?

Hello guys, I’m currently working with Js and I’d like to import a library into SL playground. How can I do it?

30th Jun 2019, 6:34 PM
Gintonic
Gintonic - avatar
18 Respostas
30th Jun 2019, 8:53 PM
dĪlĪ…Ņ•ĪlĪ…Ņ•
dĪlĪ…Ņ•ĪlĪ…Ņ• - avatar
+ 6
I don't know what libraries you have in mind, but maybe you can use CDN and link them in your project. https://cdnjs.com/
30th Jun 2019, 8:44 PM
dĪlĪ…Ņ•ĪlĪ…Ņ•
dĪlĪ…Ņ•ĪlĪ…Ņ• - avatar
+ 6
Of course, like any other script link. ✌ī¸
30th Jun 2019, 11:46 PM
dĪlĪ…Ņ•ĪlĪ…Ņ•
dĪlĪ…Ņ•ĪlĪ…Ņ• - avatar
+ 5
Great, it's looking amazing. Window.onload is not written correctly. Put this instead of the first line: window.onload= function() { When I uncomment the seventh line it works fine for me. 🙌🙌
3rd Jul 2019, 2:15 PM
dĪlĪ…Ņ•ĪlĪ…Ņ•
dĪlĪ…Ņ•ĪlĪ…Ņ• - avatar
+ 4
You obviously have one extra closing braces in line 10, read the error report. However, it seems that won't solve the issue. One more file is missing, you'll need to read the official documents and also this thread on github : https://github.com/dwa012/html5-qrcode/issues/36 https://code.sololearn.com/WZbCZ756EC7Z/?ref=app
1st Jul 2019, 12:47 PM
dĪlĪ…Ņ•ĪlĪ…Ņ•
dĪlĪ…Ņ•ĪlĪ…Ņ• - avatar
+ 3
Alright. I don't know what else to tell, except to try their official example maybe that will work for you : https://davidshimjs.github.io/qrcodejs/
1st Jul 2019, 4:08 PM
dĪlĪ…Ņ•ĪlĪ…Ņ•
dĪlĪ…Ņ•ĪlĪ…Ņ• - avatar
+ 2
Yes, that should be added too to your project. That's why you see that error. I see a qr code ? It shows every time. Maybe you should try this code outside sololearn.
1st Jul 2019, 3:40 PM
dĪlĪ…Ņ•ĪlĪ…Ņ•
dĪlĪ…Ņ•ĪlĪ…Ņ• - avatar
+ 2
dĪlĪ…Ņ•ĪlĪ…Ņ• are you able to see different profiles by changing the “profile number” input? For example: your profile number is 2251477. Thus, once you put it into the first input the qrcode should lead to your profile page because it’s sololearn.com/profile/2251477 EDIT: i’ve added .toString() method in the 7th line so that the number typed in the input turns into a string. But still doesn’t work out properly. There must be an error in the 78th line EDIT2: solved!
4th Jul 2019, 7:44 PM
Gintonic
Gintonic - avatar
+ 1
hi dĪlĪ…Ņ•ĪlĪ…Ņ• , thanks for answering. I need to use the qrcode.js library and implement it into the HTML code
30th Jun 2019, 8:46 PM
Gintonic
Gintonic - avatar
+ 1
So i just need to type in the HTML <script type=“text/javascript” src=“https://cdnjs.cloudflare.com/ajax/libs/jquery.qrcode/1.0/jquery.qrcode.min.js”></script> Right?
30th Jun 2019, 8:57 PM
Gintonic
Gintonic - avatar
1st Jul 2019, 6:35 AM
Gintonic
Gintonic - avatar
+ 1
https://code.sololearn.com/WO8yZOtCk7Lr/?ref=app Can’t find out why it says “Syntax Error” 🤔
1st Jul 2019, 9:06 AM
Gintonic
Gintonic - avatar
+ 1
Thanks for your patience, i know it’s annoying... Almost finished my code, just miss the qrcode script implementation https://code.sololearn.com/Wpw8c3rVXKa9/?ref=app
1st Jul 2019, 4:14 PM
Gintonic
Gintonic - avatar
+ 1
Ok dĪlĪ…Ņ•ĪlĪ…Ņ• good news, found a way to display the qrcode through JQuery!!🙌 Now just have to solve the problem at line 64 of the Js file. That inp1 var is not recognised
3rd Jul 2019, 1:51 PM
Gintonic
Gintonic - avatar
0
The error is: ReferenceError: Can't find variable: QRCode at Line: 1 Got few questions. That one in the Js section is a library? Run your code but it shows nothing, just a white background
1st Jul 2019, 2:33 PM
Gintonic
Gintonic - avatar
0
Ok found that it doesn’t work on ios devices. Then i pasted the code on Codepen (pc) to see if it works and it doesn’t. You can check it here —> https://codepen.io/Gintonicc/pen/EBEWev
1st Jul 2019, 3:59 PM
Gintonic
Gintonic - avatar
0
The problem is that the qrcode shows just the link https/sololearn.com/profile while it should display the https:/sololearn.com/profile/ + number of the profile (which you put in the first input). That’s like the inp1 var doesn’t work
3rd Jul 2019, 2:43 PM
Gintonic
Gintonic - avatar