error - MooTools is not defined - mootools

Joomla 2.5 website:
212.113.141.98/~artstorm/
Getting error:
Uncaught ReferenceError:
MooTools is not defined - mootools-more.js:13
Uncaught TypeError: Object [object global] has no method 'addEvent' - 212.113.141.98/~artstorm/:45
Even though mootools-more.js is defined in the source.
Any ideas?

You embed several jquery libraries, it's not recommended and not necessary.
It looks like you disable mootools in joomla (with a plugin or in your php code) and add it manually in your code. You may remove this lines, enable mootools again, disable all embeds of jquery libraries from plug-ins, and just use the last version.
If you need old function from jquery (for example "live" method wich is deprecated now) you can use the jquery migrate plugin.
then the scripts embedded in your header should look like this :
<script src="your_url/media/system/js/mootools-core.js" type="text/javascript"></script>
<script src="your_url/media/system/js/core.js" type="text/javascript"></script>
<script src="your_url/media/system/js/caption.js" type="text/javascript"></script>
<script src="your_url/media/system/js/mootools-more.js" type="text/javascript"></script>
<script src="your_url/media/system/js/modal.js" type="text/javascript"></script>
...
<script src="your_url/libraries/jquery/jquery-1.9.1.min.js" type="text/javascript"></script>
<script src="your_url/libraries/jquery/jquery-migrate-1.1.0.js" type="text/javascript"></script>
<script>
jQuery.noConflict();
</script>

Related

I have a red line under the script tag when linking to jquery [duplicate]

This question already has answers here:
What are the integrity and crossorigin attributes?
(3 answers)
Do I need Integrity and crossorigin attributes in Locally Hosted Resources?
(1 answer)
Closed 1 year ago.
Trying to link to jquery. My code works but there still is a red line under the script so i dont know what might be wrong
Here is the code
Here is what it says on the with red line under
How to include jQuery from jQuery CDN: https://code.jquery.com/
Latest jQuery 3 version:
<script
src="https://code.jquery.com/jquery-3.6.0.min.js"
integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="
crossorigin="anonymous"></script>
The integrity and crossorigin attributes are used for Subresource
Integrity (SRI) checking. This allows browsers to ensure that
resources hosted on third-party servers have not been tampered with.
Use of SRI is recommended as a best-practice, whenever libraries are
loaded from a third-party source.
I think all is said shortly and clearly and there's no need to add something else.
About integrity attribute of the minified version 3.3.1
<script
src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>

How do you use a background.html page (instead of background.js) with Manifest 2 in a Chrome Extension

I have a Chrome Extension that worked great with the background specified as a script (background.js). Chrome created a virtual background.html page...
I need to a script to background (to get Google Drive integration) and so (as I understand it) need to move to background.html.
My Manifest now specifies:
"background": {
"page": "background.html"},
I added "https://apis.google.com/js/api.js" to my original setup (below) to gain Google Drive access for my Chrome Extension...but my background page was throwing "gapi is not defined" errors...so I switched to background.html to try and get my background processes to be able to access the Drive scripts.
"background": {
"scripts": ["/dscripts/jquery-3.1.1.min.js","/dscripts/firebase.js","/dscripts/bootstrap-multiselect.min.js","/dscripts/bootstrap.min.js", "https://apis.google.com/js/api.js", "/scripts/background.js"]},
My new background.html page looks like:
<!DOCTYPE html>
<html>
<head>
<!--Original javascript / CDN -->
<script type="text/javascript" src="dscripts/jquery-3.1.1.min.js"></script>
<script type="text/javascript" src="dscripts/jquery-ui.min.js"></script>
<script type="text/javascript" src="dscripts/bootstrap.min.js"></script>
<script type="text/javascript" src="dscripts/bootstrap-toggle.min.js"></script>
<!-- FIREBASE - I think we only need JS, not app.js and auth.js -->
<script src="dscripts/firebase.js"></script>
<!-- <script src="https://www.gstatic.com/firebasejs/4.6.2/firebase.js"></script>
<script> -->
<!-- Google APIS -->
<script type="text/javascript" src="https://apis.google.com/js/api.js"></script>
<!-- background.js -->
<script type="text/javascript" src="scripts/background.js">
</head>
</html>
I haven't made any changes to background.js - which holds chrome.runtime.onStartup.addListener and lots of well-established logic.
When I run my Extension and view the background.html console, I get:
Navigated to chrome-extension://XXXXX/background.html
Usually there would be a ton of debug console content generated by my background.js file. It's as if the background.js doesn't run.
Which makes sense, I guess - there's no dom to load and trigger actions.
I feel like I'm missing something really obvious (apologies) - but all the examples I could find use background.js, not background.html.
How do I get my javascript to fire when specifying background.html?
Was missing closing tag on the background.js file. Once I added that then the js in background ran exactly as expected.
So there is no extra action (for those coming after) required to use your own background.html page vs. the auto-generated one.

Load ssl via relative `src`

Haven't been able to find anything posted about this, but is it possible to load https:// Via a relative URL?
On my testing server that is located at example.com:3000 I reference my scripts explicitly like so :
<script type="text/javascript" src="https://example.com:3000/js/dist.js"></script>
This is fine but anytime I switch over to production I need to change this to:
<script type="text/javascript" src="https://example.com/js/dist.js"></script>
What I am wondering is if it is possible to load it like below but ensure that it will be loaded over ssl:
<script type="text/javascript" src="/js/dist.js"></script>

How do I create a relative link to a downloaded jquery library?

I am having trouble linking to a jquery library and am wondering if someone might be able to point out what I am doing wrong.
My html page is a locally hosted Sharepoint site here:
http://server/sites/blog/dude/Pages/MyPage.html
and my jquery library is located here:
http://server/sites/blog/style%20library/js/jquery-1.7.2.min.js
I it works fine if I reference the whole jquery address like so:
<script language="javascript" type="text/javascript" src='http://server/sites/blog/style%20library/js/jquery-1.7.2.min.js'></script>
But it isn't located when I do this:
<script language="javascript" type="text/javascript" src='../../blog/style%20library/js/jquery-1.7.2.min.js'></script>
Am I using the "folder up" syntax incorrectly perhaps?
Just put /sites/blog/style%20library/js/jquery-1.7.2.min.js
The leading slash tells the browser to go to the host and start from there.

ReferenceError: google is not defined

I use google map's api in my website to show couple of locations. Google Maps is working just fine in my local solution but not in my website. I changed this source
<script type="text/javascript" src="http://maps.google.com/maps/api/js?v=3.5&sensor=false"> </script>
to this one. and i again changed this
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"> </script>
with this one...
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false"> </script>
Only thing it says: ReferenceError: google is not defined
Does anyone familiar with such problem?
Owing to the fact that my website uses https for the connection, I can not use http://maps.google.com/maps/api/js?sensor=false. When I debug the whole page, this link says: Warning : The page index.html ran insecure content. so I made another search on google and came across to this question. so what basically causes a problem is not using https link in the source part so the correct link will be (for me)
https://maps.google.com/maps/api/js?sensor=false
now everything works just fine!
That's an old URL. If you look at the examples from the documentation, almost all of them use:
<script src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>
To me, with the new Google Maps API, simply this solution worked:
Just omit "async defer" from the script provided by goolge:
<script async defer src="https://maps.googleapis.com/maps/api/js?key={your_key}"></script>
TO
<script src="https://maps.googleapis.com/maps/api/js?key={your_key}"></script>
i met this problem in the rails application.
request to googlemap was from http and https pages
and it solved:
= javascript_include_tag "//maps.google.com/maps/api/js?sensor=false"
if protocol not defined rails inserts automatic