+ 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?
17 Respuestas
+ 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/
+ 6
Of course, like any other script link. ✌️
+ 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.
🙌🙌
+ 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
+ 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/
+ 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.
+ 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!
+ 1
hi dρlυѕρlυѕ , thanks for answering. I need to use the qrcode.js library and implement it into the HTML code
+ 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?
+ 1
thank you dρlυѕρlυѕ !
+ 1
https://code.sololearn.com/WO8yZOtCk7Lr/?ref=app
Can’t find out why it says “Syntax Error”
🤔
+ 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
+ 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
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
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
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