How to use Prototype.js in DNN 6.x? - prototypejs

I am using DNN 6.x which uses JQuery by default. I have a requirement to use prototype.js in some of modules that I am building. As $ variable is used by both the libraries I am getting various errors on the page. Is there a way I can use prototype in DNN 6.x without getting conflict errors?
Thanks
Dev

You can configure jQuery not to use the $ variable. Run this before anything else, just after you've added the jQuery script:
jQuery.noConflict();
This requires all code using jQuery not to use $, but instead jQuery, i.e.
jQuery("#selector").show()
instead of
$("#selector").show()
You can read more about noConflict here.

Related

Having problems with Dojo making HTTP requests on a HTTPS site

I'm attempting to use a vBulletin plugin called "MGC Chatbox Evo". This plugin uses the Dojo library, but I'm having some trouble making it work via HTTPS.
Within the plugin, the library is called as such:
$js .= '<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/dojo/1.6.1/dojo/dojo.xd.js" data-dojo-config="parseOnLoad: true"></script>';
This loads that particular fine over HTTPS. However, this subsequently seems to attempt to load further files, of which I can find absolutely no reference of in the source files for the plugin (using find in Notepad++). I wondered if anyone had any idea as to how I can force these requests to be made via HTTPS instead of HTTP, as they are currently being automatically blocked. Thanks.
http://i.imgur.com/gQfkzp6.png
Would you be able to modify that script tag to load Dojo 1.6.2 instead of 1.6.1? I think that may fix your problem.
Here's why. This is from the uncompressed CDN version of dojo.xd.js in 1.6.1:
dojo.registerModulePath("dojo", "http://ajax.googleapis.com/ajax/libs/dojo/1.6.1/dojo");
dojo.registerModulePath("dijit", "http://ajax.googleapis.com/ajax/libs/dojo/1.6.1/dijit");
dojo.registerModulePath("dojox", "http://ajax.googleapis.com/ajax/libs/dojo/1.6.1/dojox");
Then here's the same lines from 1.6.2:
dojo.registerModulePath("dojo", "//ajax.googleapis.com/ajax/libs/dojo/1.6.2/dojo");
dojo.registerModulePath("dijit", "//ajax.googleapis.com/ajax/libs/dojo/1.6.2/dijit");
dojo.registerModulePath("dojox", "//ajax.googleapis.com/ajax/libs/dojo/1.6.2/dojox");
These paths instruct Dojo where to load additional modules that are requested via dojo.require. Notice that the URLs in 1.6.1 are hard-coded to http, but in 1.6.2 are protocol-relative.

remoteLink deprecated in Grails 2.4, now what?

I noticed in Grails 2.4 documentation (http://grails.org/doc/latest/ref/Tags/remoteLink.html), it mentioned the remoteLink tag is now deprecated.
But I don't understand the second part of the warning:
"Applications may provide their own Ajax tags and/or Javascript plugins may provide Ajax tags of their own".
So it will be simply removed so we shouldn't use it at all? What is the replacement for that?
Thanks.
Basically, they're removing the tags because they don't add much value, and instead contribute to bad design patterns - they're too low level. It's usually best to play within whatever Javascript frameworks you're using, and make higher level tags that make the AJAX calls for a purpose, rather than having a Grails tag JUST for making an AJAX call.
https://groups.google.com/forum/#!topic/grails-dev-discuss/IXvqDUr6CIE
https://groups.google.com/forum/#!topic/grails-dev-discuss/4yesijtFSB4

CKEditor: How to manually trigger ACF(Advanced Content Filter)

With older version of CKEditor, I use following code to manually trigger Advanced Content Filter before submitting the content to server, but this stopped working for Version 4.4. I wonder is there a way to manually trigger the ACF and/or other kinds of content validation in CKEditor?
editor.setData(editor.getData(););
Your solution actually worked for me! To be more precise, I used CKEDITOR.instances['instance_name'].setData( CKEDITOR.instances['instance_name'].getData() ) and it worked!
To other people asking: this can be very useful even if you have ACF turned ON; in our app there's a number of situations that we manipulate the DOM inside CKEditor directly using jQuery for some very custom features we have (we actually create some UI inside the editor area), but we don't want that forbidden HTML going to the server and this solution works perfectly.
(Of course we always sanitize on the server as well)
For us this
CKEDITOR.instances['instance_name'].setData( CKEDITOR.instances['instance_name'].getData() )
didn't work, but getting the data with 1 in the arguments worked.
CKEDITOR.instances['instance_name'].setData( CKEDITOR.instances['instance_name'].getData(1) )

Joomla : Want to build custom form with my own back hand code

I just want to create custom html with good css form with my own php as backhand code and javascript for validation.. Is there any extension for this?
I have seen few extensions but none of them allows me to add my own php backhand code.
Thanks
If you are not going to use Joomla's framework, then you may as well build the form outside of joomla and insert it into the article via an iframe (you may need to change the editor's permissions to allow you to do this).
It is worth looking into using the framework properly, however, as it does have easy-to-use mail classes and actually makes things easier when you get your head around it.
(Though to answer your actual question - this module appears to allow you to add raw php http://extensions.joomla.org/extensions/core-enhancements/coding-a-scripts-integration/custom-code-in-modules/3668 )

Bootstrap jquery methods Magento's prototype lib

Wonder if anyone has had this issue.
I've integrated Bootstrap nicely into a Magento theme I'm building, all good.
That is, until I try using the accordian functions. There seems to be an issue with the code finding the Prototype Libs Methods instead of jQuery's. I've tried the usual fixes, $ - jQuery and no conflict but it only works when I disable the prototype lib - which obviously is not good.
Anyone out there come across this and can advise me on a work round? At the moment I'm resigned to using Scriptaculous for the accordian.
I suspect this is occurring due to the transitional conflict in prototype which is used in Magento front-end and admin areas.
Please see: Twitter Bootstrap Transition Conflict prototypejs
You can try this library: https://github.com/jwestbrook/bootstrap-prototype and see if it resolves your issue you are having with your accordian.
Using jQuery in Magento can be sometimes tricky. I normally make something like:
jquery-ui-1.8.9.noconflict.min.js
and put jQuery.noConflict() right at the end of the file.
Also make sure that jQuery is loaded after Prototype & there is only 1 version of jQuery included on any page.
I normally like to use jQuery instead of $ all the time but I guess anonymous functions should work too:
(function($) { /* use $ here */ })(jQuery);
Instead of bootstrap.js or bootstrap.min.js use below js files to get the solution.
jquery.js
prettify.js
bootstrap-transition.js
bootstrap-alert.js
bootstrap-modal.js
bootstrap-dropdown.js
bootstrap-scrollspy.js
bootstrap-tab.js
bootstrap-tooltip.js
bootstrap-popover.js
bootstrap-button.js
bootstrap-collapse.js
bootstrap-carousel.js
bootstrap-typeahead.js
application.js more if required.

Resources