[12]Upgrade to mootools 1.2
- Dionisiy
- Joomla! Intern
- Posts: 98
- Joined: Thu Mar 16, 2006 11:00 am
- Location: Minsk, Belarus
- Contact:
[12]Upgrade to mootools 1.2
mootools 1.2 is already in beta and will be released soon.
It is a great improovement of mootools.
It is a great improovement of mootools.
- pointri
- Joomla! Explorer
- Posts: 283
- Joined: Wed Aug 24, 2005 2:02 pm
- Location: Rhode Island, USA
Re: Upgrade to mootools 1.2
I concur (Swiff!), but we should whitepaperify these kinds of requests made for upgrading external libraries: new Mootools behaviors implemented in the core, etc.
- Dionisiy
- Joomla! Intern
- Posts: 98
- Joined: Thu Mar 16, 2006 11:00 am
- Location: Minsk, Belarus
- Contact:
Re: Upgrade to mootools 1.2
Joomla uses digitarald.be stuff mostly and it has support for 1.2 I think
-
- Joomla! Enthusiast
- Posts: 122
- Joined: Thu Nov 17, 2005 12:31 am
- Contact:
Re: Upgrade to mootools 1.2
I replaced the mootools.js file of joomla with the version 1.2 and some things of joomla didn't work, not even with backwards compatibility enabled on mootools 1.2
Thats to bad because I'd like to use some of to new features of mootools 1.2!
I'd like to know what the developers of Joomla think about mootools 1.2, its important to let know to all the 3rd party developers what is going to be te future of mootools on joomla. Should they start testing and upgrading their extensions against mootools 1.2?
Thats to bad because I'd like to use some of to new features of mootools 1.2!
I'd like to know what the developers of Joomla think about mootools 1.2, its important to let know to all the 3rd party developers what is going to be te future of mootools on joomla. Should they start testing and upgrading their extensions against mootools 1.2?
-
- Joomla! Enthusiast
- Posts: 247
- Joined: Sat May 20, 2006 7:58 am
- Location: Norway
Re: Upgrade to mootools 1.2
The roadmap at http://dev.joomla.org/content/view/23/61/ states that a "New javascript framework" will be incorporated into "Future versions" of Joomla!. Are we talking about a MooTools upgrade or a completely new one? If so, why have one decided to move away from MooTools? Or is "framework" different from "library"?
Stian
Stian
-
- Joomla! Enthusiast
- Posts: 122
- Joined: Thu Nov 17, 2005 12:31 am
- Contact:
Re: Upgrade to mootools 1.2
It looks like that document is outdated (Last Updated ( Wednesday, 19 December 2007 ) )
Maybe that new javascript framework is the now present Mootools and others javascript libraries
Maybe that new javascript framework is the now present Mootools and others javascript libraries
- Hackwar
- Joomla! Virtuoso
- Posts: 3788
- Joined: Fri Sep 16, 2005 8:41 pm
- Location: NRW - Germany
- Contact:
Re: Upgrade to mootools 1.2
that list is pretty outdated. We will stay with mootools. The question is just how to move to 1.2 without breaking backwards compatibility.
god doesn't play dice with the universe. not after that drunken night with the devil where he lost classical mechanics in a game of craps.
Since the creation of the Internet, the Earth's rotation has been fueled, primarily, by the collective spinning of English teachers in their graves.
Since the creation of the Internet, the Earth's rotation has been fueled, primarily, by the collective spinning of English teachers in their graves.
- dkarlovi
- Joomla! Intern
- Posts: 95
- Joined: Wed Sep 26, 2007 10:59 am
- Contact:
Re: Upgrade to mootools 1.2
Mootools 1.2 has a 1.1 compatibility layer.Hackwar wrote:that list is pretty outdated. We will stay with mootools. The question is just how to move to 1.2 without breaking backwards compatibility.
- Hackwar
- Joomla! Virtuoso
- Posts: 3788
- Joined: Fri Sep 16, 2005 8:41 pm
- Location: NRW - Germany
- Contact:
Re: Upgrade to mootools 1.2
Which does not work for about 50% of the scripts.dkarlovi wrote:Mootools 1.2 has a 1.1 compatibility layer.Hackwar wrote:that list is pretty outdated. We will stay with mootools. The question is just how to move to 1.2 without breaking backwards compatibility.
god doesn't play dice with the universe. not after that drunken night with the devil where he lost classical mechanics in a game of craps.
Since the creation of the Internet, the Earth's rotation has been fueled, primarily, by the collective spinning of English teachers in their graves.
Since the creation of the Internet, the Earth's rotation has been fueled, primarily, by the collective spinning of English teachers in their graves.
- dkarlovi
- Joomla! Intern
- Posts: 95
- Joined: Wed Sep 26, 2007 10:59 am
- Contact:
Re: Upgrade to mootools 1.2
Do what you'd expect Joomla users to do, use it, find bugs, report them to MT guys. I'm porting my MT stuff over to 1.2 anyway so don't mind either way, but you shouldn't hold on to 1.1 just because some scripts don't work, 1.2 is really way better to work with and I'm sure, with exposure Joomla brought to MT, those guys would be glad to fix stuff.Hackwar wrote:Which does not work for about 50% of the scripts.dkarlovi wrote:Mootools 1.2 has a 1.1 compatibility layer.Hackwar wrote:that list is pretty outdated. We will stay with mootools. The question is just how to move to 1.2 without breaking backwards compatibility.
- jiggliemon
- Joomla! Intern
- Posts: 81
- Joined: Wed Nov 22, 2006 6:18 am
- Contact:
Re: [12]Upgrade to mootools 1.2
A Quick hack but it's worked so far.
JFactory HTML Behaviors or something. I forget exactly where the Mootols behavior is located, but it's easy to find.
JFactory HTML Behaviors or something. I forget exactly where the Mootols behavior is located, but it's easy to find.
Code: Select all
function mootools($debug = null)
{
global $mainframe;
static $loaded;
$administrator = JFactory::getApplication('administrator');
// Only load once
if ($loaded) {
return;
}
// If no debugging value is set, use the configuration setting
if ($debug === null) {
$config = &JFactory::getConfig();
$debug = $config->getValue('config.debug');
}
// TODO NOTE: Here we are checking for Konqueror - If they fix thier issue with compressed, we will need to update this
$konkcheck = strpos (strtolower($_SERVER['HTTP_USER_AGENT']), "konqueror");
if ($debug || $konkcheck) {
JHTML::script('mootools-uncompressed.js', 'media/system/js/', false);
} else {
//////////////////////////THIS IS THE MOOTOOLS SWITCHER////////////////////////////////
// interface is for the front end show 1.2b
if($mainframe->isSite())
{
JHTML::script('mootools2.js', 'media/system/js/', false);
//Otherwise, use the stable 1.11
}else{
JHTML::script('mootools.js', 'media/system/js/', false);
}
}
$loaded = true;
return;
}
-
- Joomla! Explorer
- Posts: 343
- Joined: Fri Aug 19, 2005 12:12 pm
- Location: Out of my mind ...sometimes
Re: [12]Upgrade to mootools 1.2
Hi,
with this hack + a little plug here:
http://extensions.joomla.org/component/ ... /cat_id,0/
which sends js/css files to head
one can test easily the new demos displayed on the new Mootools site for 1.2 stable
http://demos.mootools.net/
with this hack + a little plug here:
http://extensions.joomla.org/component/ ... /cat_id,0/
which sends js/css files to head
one can test easily the new demos displayed on the new Mootools site for 1.2 stable
http://demos.mootools.net/
-
- Joomla! Ace
- Posts: 1318
- Joined: Wed Aug 17, 2005 11:06 pm
- Location: Lithuania
- Contact:
Re: [12]Upgrade to mootools 1.2
1.2 is a lot more stable, we should upgrade
Lithuanian Joomla! Community http://www.lithuanianjoomla.com
lietuviškas Joomla! puslapis, naujienos, straipsniai, forumas, vertimai
always be open source, and be free as freedom
lietuviškas Joomla! puslapis, naujienos, straipsniai, forumas, vertimai
always be open source, and be free as freedom
-
- Joomla! Explorer
- Posts: 343
- Joined: Fri Aug 19, 2005 12:12 pm
- Location: Out of my mind ...sometimes
Re: [12]Upgrade to mootools 1.2
Yep.
But there will be a lot of re-coding to port mootools1.11 based apps to the update.
One of mootools developers provides a "compatibility layer" :
http://digitarald.de/journal/38150523/m ... ity-layer/
Haven't tested it.
Here is the aforementionned code corrected with the 2 new libraries dowloadable from mootools.net, mootools-1.2-core.js and mootools-1.2-more.js. Files to be added in media/system/js folder.
But there will be a lot of re-coding to port mootools1.11 based apps to the update.
One of mootools developers provides a "compatibility layer" :
http://digitarald.de/journal/38150523/m ... ity-layer/
Haven't tested it.
Here is the aforementionned code corrected with the 2 new libraries dowloadable from mootools.net, mootools-1.2-core.js and mootools-1.2-more.js. Files to be added in media/system/js folder.
Code: Select all
function mootools($debug = null)
{
global $mainframe;
static $loaded;
$administrator = JFactory::getApplication('administrator');
// Only load once
if ($loaded) {
return;
}
// If no debugging value is set, use the configuration setting
if ($debug === null) {
$config = &JFactory::getConfig();
$debug = $config->getValue('config.debug');
}
// TODO NOTE: Here we are checking for Konqueror - If they fix thier issue with compressed, we will need to update this
$konkcheck = strpos (strtolower($_SERVER['HTTP_USER_AGENT']), "konqueror");
if ($debug || $konkcheck) {
JHTML::script('mootools-uncompressed.js', 'media/system/js/', false);
} else {
//////////////////////////THIS IS THE MOOTOOLS SWITCHER////////////////////////////////
// interface is for the front end show 1.2b
if($mainframe->isSite())
{
JHTML::script('mootools-1.2-core.js', 'media/system/js/', false);
JHTML::script('mootools-1.2-more.js', 'media/system/js/', false);
//Otherwise, use the stable 1.11
}else{
JHTML::script('mootools.js', 'media/system/js/', false);
}
}
$loaded = true;
return;
}
- pollen8
- Joomla! Explorer
- Posts: 350
- Joined: Wed Aug 17, 2005 10:32 pm
- Location: la Rochelle - France
- Contact:
Re: [12]Upgrade to mootools 1.2
here's a mootools 1.2 and Joomla 1.5 compatible version of the Tips code:
Basically I'm porting Fabrik's mootools code to mootools 1.2 so would be willing to submit code if so desired?
Code: Select all
var Tips = new Class({
Implements: [Events, Options],
options: {
onShow: function(tip){
tip.setStyle('visibility', 'visible');
},
onHide: function(tip){
tip.setStyle('visibility', 'hidden');
},
showDelay: 100,
hideDelay: 100,
className: 'tool',
offsets: {x: 16, y: 16},
fixed: false
},
initialize: function(){
var params = Array.link(arguments, {options: Object.type, elements: $defined});
this.setOptions(params.options || null);
this.tip = new Element('div',{'class': this.options.className + '-tip'}).inject(document.body);
if (this.options.className) this.tip.addClass(this.options.className);
var top = new Element('div', {'class': 'tip-top'}).inject(this.tip);
this.container = new Element('div', {'class': 'tip'}).inject(this.tip);
var bottom = new Element('div', {'class': 'tip-bottom'}).inject(this.tip);
this.tip.setStyles({position: 'absolute', top: 0, left: 0, visibility: 'hidden'});
if (params.elements) this.attach(params.elements);
},
attach: function(elements){
$$(elements).each(function(element){
var title = element.retrieve('tip:title', element.get('title'));
var dual = title .split('::');
var text = element.retrieve('tip:text', element.get('rel') || element.get('href'));
if (dual.length > 1){
var text = dual[1].trim();
var title = dual[0].trim();
}else{
var text = dual[0].trim();
var title = '';
}
element.store('tip:title', title);
element.store('tip:text', text);
var enter = element.retrieve('tip:enter', this.elementEnter.bindWithEvent(this, element));
var leave = element.retrieve('tip:leave', this.elementLeave.bindWithEvent(this, element));
element.addEvents({mouseenter: enter, mouseleave: leave});
if (!this.options.fixed){
var move = element.retrieve('tip:move', this.elementMove.bindWithEvent(this, element));
element.addEvent('mousemove', move);
}
element.store('tip:native', element.get('title'));
element.erase('title');
}, this);
return this;
},
detach: function(elements){
$$(elements).each(function(element){
element.removeEvent('mouseenter', element.retrieve('tip:enter') || $empty);
element.removeEvent('mouseleave', element.retrieve('tip:leave') || $empty);
element.removeEvent('mousemove', element.retrieve('tip:move') || $empty);
element.eliminate('tip:enter').eliminate('tip:leave').eliminate('tip:move');
var original = element.retrieve('tip:native');
if (original) element.set('title', original);
});
return this;
},
elementEnter: function(event, element){
$A(this.container.childNodes).each(Element.dispose);
var title = element.retrieve('tip:title');
if (title){
this.titleElement = new Element('div', {'class': this.options.className + '-title'}).inject(this.container);
this.fill(this.titleElement, title);
}
var text = element.retrieve('tip:text');
if (text){
this.textElement = new Element('div', {'class': this.options.className + '-text'}).inject(this.container);
this.fill(this.textElement, text);
}
this.timer = $clear(this.timer);
this.timer = this.show.delay(this.options.showDelay, this);
this.position((!this.options.fixed) ? event : {page: element.getPosition()});
},
elementLeave: function(event){
$clear(this.timer);
this.timer = this.hide.delay(this.options.hideDelay, this);
},
elementMove: function(event){
this.position(event);
},
position: function(event){
var size = window.getSize(), scroll = window.getScroll();
var tip = {x: this.tip.offsetWidth, y: this.tip.offsetHeight};
var props = {x: 'left', y: 'top'};
for (var z in props){
var pos = event.page[z] + this.options.offsets[z];
if ((pos + tip[z] - scroll[z]) > size[z]) pos = event.page[z] - this.options.offsets[z] - tip[z];
this.tip.setStyle(props[z], pos);
}
},
fill: function(element, contents){
(typeof contents == 'string') ? element.set('html', contents) : element.adopt(contents);
},
show: function(){
this.fireEvent('show', this.tip);
},
hide: function(){
this.fireEvent('hide', this.tip);
}
});
aka
- pollen8
- Joomla! Explorer
- Posts: 350
- Joined: Wed Aug 17, 2005 10:32 pm
- Location: la Rochelle - France
- Contact:
Re: [12]Upgrade to mootools 1.2
also found this script which addresses more compat issues between 1.1. and 1.2
http://www.siafoo.net/snippet/137#description
http://www.siafoo.net/snippet/137#description
aka
- mihu
- Joomla! Guru
- Posts: 741
- Joined: Mon Mar 20, 2006 8:17 am
Re: [12]Upgrade to mootools 1.2
I load those 4 mootools scripts
You can find Compatibility files from here too
http://blog.mootools.net/2008/6/12/moot ... s-official
You need to modify behavior.php mootools function as mentioned above and also upload those files.
It seems to me calendar and tooltops are broken. I think we can report all joomla scripts which broken here.
For those who wanna help Joomla to fix those broken script for mootools 1.2, please either report the issue you found or provides a patch to speed up the process. (I as speak as individual instead of DEV WG)
I found this link, and I hope this would help.
http://github.com/mootools/mootools-cor ... -11-to-1-2
Code: Select all
JHTML::script('mootools-1.2-core.js', 'media/system/js/', false);
JHTML::script('mootools-1.2-compat-core.js', 'media/system/js/', false);
JHTML::script('mootools-1.2-more.js', 'media/system/js/', false);
JHTML::script('mootools-1.2-compat-more.js', 'media/system/js/', false);
http://blog.mootools.net/2008/6/12/moot ... s-official
You need to modify behavior.php mootools function as mentioned above and also upload those files.
It seems to me calendar and tooltops are broken. I think we can report all joomla scripts which broken here.
For those who wanna help Joomla to fix those broken script for mootools 1.2, please either report the issue you found or provides a patch to speed up the process. (I as speak as individual instead of DEV WG)
I found this link, and I hope this would help.
http://github.com/mootools/mootools-cor ... -11-to-1-2
bento2go.com - We DO NOT sell bento !!
- hotnuts21
- Joomla! Explorer
- Posts: 315
- Joined: Wed Aug 17, 2005 11:11 pm
Re: [12]Upgrade to mootools 1.2
Just a thought, I may be well of base here but could we not link this up with another suggestion to enable people to disable mootools altogether and then give the user the choice?
For example, load mootools 1.2 in the admin by default no choice.
But for the front end, the user can have one of the following options, (in config?)
Load mootools 1.2
load mootools 1.1 (backward compatibility for all those modules and custom hacks using 1.1)
Disable Mootools
provide link (so people can provide a link to another lib such as the google ajax API's)
In the front end very little actually really requires mootools, except for the caption if I am not mistaken, and that could probably be written to use 1.1 or 1.2 so those people who dont want the load overhead are happy.
It also addresses another whitepaper issue that was raised about disabling mootools altogether.
For example, load mootools 1.2 in the admin by default no choice.
But for the front end, the user can have one of the following options, (in config?)
Load mootools 1.2
load mootools 1.1 (backward compatibility for all those modules and custom hacks using 1.1)
Disable Mootools
provide link (so people can provide a link to another lib such as the google ajax API's)
In the front end very little actually really requires mootools, except for the caption if I am not mistaken, and that could probably be written to use 1.1 or 1.2 so those people who dont want the load overhead are happy.
It also addresses another whitepaper issue that was raised about disabling mootools altogether.
- pollen8
- Joomla! Explorer
- Posts: 350
- Joined: Wed Aug 17, 2005 10:32 pm
- Location: la Rochelle - France
- Contact:
Re: [12]Upgrade to mootools 1.2
on another thought - it would also make sense to get the mootools file from one central server. Meaning that users would only ever need to download the file once for all the Joomla sites they encounter.
I *think * this type of option is available for dojo and is hosted with Google.
I *think * this type of option is available for dojo and is hosted with Google.
aka
- mihu
- Joomla! Guru
- Posts: 741
- Joined: Mon Mar 20, 2006 8:17 am
Re: [12]Upgrade to mootools 1.2
regard to hold at a central place, there are some debates. Not everyone like to host their scripts at other place.
bento2go.com - We DO NOT sell bento !!
-
- Joomla! Ace
- Posts: 1318
- Joined: Wed Aug 17, 2005 11:06 pm
- Location: Lithuania
- Contact:
Re: [12]Upgrade to mootools 1.2
please do not host scripts at other place
Lithuanian Joomla! Community http://www.lithuanianjoomla.com
lietuviškas Joomla! puslapis, naujienos, straipsniai, forumas, vertimai
always be open source, and be free as freedom
lietuviškas Joomla! puslapis, naujienos, straipsniai, forumas, vertimai
always be open source, and be free as freedom
- pollen8
- Joomla! Explorer
- Posts: 350
- Joined: Wed Aug 17, 2005 10:32 pm
- Location: la Rochelle - France
- Contact:
Re: [12]Upgrade to mootools 1.2
Remote hosted javascript files are a very common use case these days, we don't all run google maps, adwords, [youtube], daily motion applications on our own servers do we? No these services are supplied via various remote techniques be they javascript embeds or iframes.
I can understand the feeling of loosing control over your files, but I'd trust Google to have more uptime than any server I can run. By hosting in one location you alleviate the concern over repetitive downloads as it's a one time only download for every Joomla site you will ever use
Looking at it Google already host mootools:
http://code.google.com/apis/ajaxlibs/
More and more components will be using mootools in the front end simply because they will want to make the most of the functionality provided by mootools, and as component become native to 1.5 they will, I imagine, be replacing the other js libraires (prototype, dojo, etc) with mootools compatible code.
To me giving at least the option to link to a hosted mootools script makes so much more sense than building in a mechanism for not loading mootools into the front end at all.
Looking forward to hearing why this isn't a good idea
Rob
I can understand the feeling of loosing control over your files, but I'd trust Google to have more uptime than any server I can run. By hosting in one location you alleviate the concern over repetitive downloads as it's a one time only download for every Joomla site you will ever use
Looking at it Google already host mootools:
http://code.google.com/apis/ajaxlibs/
More and more components will be using mootools in the front end simply because they will want to make the most of the functionality provided by mootools, and as component become native to 1.5 they will, I imagine, be replacing the other js libraires (prototype, dojo, etc) with mootools compatible code.
To me giving at least the option to link to a hosted mootools script makes so much more sense than building in a mechanism for not loading mootools into the front end at all.
Looking forward to hearing why this isn't a good idea
Rob
aka
- hotnuts21
- Joomla! Explorer
- Posts: 315
- Joined: Wed Aug 17, 2005 11:11 pm
Re: [12]Upgrade to mootools 1.2
Its not that its not a good idea, or a bad idea, but different people have different needs. Hence why I suggested the option to allow people to choose, not everyone has the same needs. Also its worth noting that Amazons cloud went down recently (which is similar to the cloud google uses to host is ajaxapis) and google also had some downtime on some of its servers. A lot of people rely and trust the amazon cloud to host their sites, this downtime was not good. Technically my little server has better uptime than that this year, what would you do if your files were hosted here, you would be stuck without ajax!! Going back to the 'choice switch' if this was an option then if your google or other hosted site went down, you could at least switch to a local version as a backup.pollen8 wrote: Looking forward to hearing why this isn't a good idea
Rob
Hope that makes sense
- pollen8
- Joomla! Explorer
- Posts: 350
- Joined: Wed Aug 17, 2005 10:32 pm
- Location: la Rochelle - France
- Contact:
Re: [12]Upgrade to mootools 1.2
Not sure, but wouldn't it used the cached version (presuming that you had it cached, which if it was hosted in one place would be by several magnitudes more likely)?what would you do if your files were hosted here, you would be stuck without ajax
Think we are debating from similar points :
option to:
use remote mootools
OR
use local mootools
OR
turn off mootools
would cover most people .
But really all this is less important to me that getting 1.2 support in Joomla.
aka
-
- Joomla! Ace
- Posts: 1318
- Joined: Wed Aug 17, 2005 11:06 pm
- Location: Lithuania
- Contact:
Re: [12]Upgrade to mootools 1.2
I am strongly against such idea, cause I simply don't want to have my cms partly hosted by someone else
Its very simple
Its very simple
Lithuanian Joomla! Community http://www.lithuanianjoomla.com
lietuviškas Joomla! puslapis, naujienos, straipsniai, forumas, vertimai
always be open source, and be free as freedom
lietuviškas Joomla! puslapis, naujienos, straipsniai, forumas, vertimai
always be open source, and be free as freedom
-
- Joomla! Ace
- Posts: 1318
- Joined: Wed Aug 17, 2005 11:06 pm
- Location: Lithuania
- Contact:
Re: [12]Upgrade to mootools 1.2
and yes, better just get local 1.2 mootools
Lithuanian Joomla! Community http://www.lithuanianjoomla.com
lietuviškas Joomla! puslapis, naujienos, straipsniai, forumas, vertimai
always be open source, and be free as freedom
lietuviškas Joomla! puslapis, naujienos, straipsniai, forumas, vertimai
always be open source, and be free as freedom
-
- Joomla! Explorer
- Posts: 343
- Joined: Fri Aug 19, 2005 12:12 pm
- Location: Out of my mind ...sometimes
Re: [12]Upgrade to mootools 1.2
In case anyone needs a caption.js file updated to Mootools 1.2, here it is :
(modified with the help of ppl at the unofficial mootools forum, mooforum.net, the official one being on googlegroups, http://groups.google.com/group/mootools-users)
(modified with the help of ppl at the unofficial mootools forum, mooforum.net, the official one being on googlegroups, http://groups.google.com/group/mootools-users)
Code: Select all
var myCaption = new Class({
initialize: function(selector)
{
this.selector = selector;
$each($$(selector), function(item){
this.createCaption(item);
}, this);
},
createCaption: function(zielement)
{
var caption = document.createTextNode(zielement.title);
var container = document.createElement('div');
var text = document.createElement('p');
var width = zielement.getAttribute('width');
var align = zielement.getAttribute('align');
if(!width) {
width = zielement.width;
}
text.appendChild(caption);
container.inject(zielement, 'before');
container.appendChild(zielement);
if(zielement.title != '') {
container.appendChild(text);
}
container.className = this.selector.replace('.', '_');
container.className = container.className + '' + align;
container.setAttribute('style','float:'+align);
container.style.width = width + 'px';
}
});
document.caption = null;
window.addEvent('load', function() {
var caption = new myCaption('img.caption')
document.caption = caption
});
-
- Joomla! Ace
- Posts: 1318
- Joined: Wed Aug 17, 2005 11:06 pm
- Location: Lithuania
- Contact:
Re: [12]Upgrade to mootools 1.2
by the way - we'll soon have 1.2.1 Mootools Bug Fix release, don't miss it
Lithuanian Joomla! Community http://www.lithuanianjoomla.com
lietuviškas Joomla! puslapis, naujienos, straipsniai, forumas, vertimai
always be open source, and be free as freedom
lietuviškas Joomla! puslapis, naujienos, straipsniai, forumas, vertimai
always be open source, and be free as freedom
-
- Joomla! Fledgling
- Posts: 1
- Joined: Tue Aug 26, 2008 12:32 pm
Re: [12]Upgrade to mootools 1.2
Hi,
I wanted to know when the new version of mootools will be part of Joomla. Will it be in one of the next 1.5.x releses or not until version 1.6?
I also edited some js files in Joomla to be compatible with mootools 1.2 but hadn't the time to test them jet...
switcher.js
validate.js
There are also some updated external scripts which work with mootools 1.2:
- SqueezeBox (modal.js): http://digitarald.de/project/squeezebox/
- FancyUpload (swf.js and uploader.js): http://digitarald.de/project/fancyupload/
These maybe will also break some code (like mootools 1.2 does), but i haven't tested it jet.
I wanted to know when the new version of mootools will be part of Joomla. Will it be in one of the next 1.5.x releses or not until version 1.6?
I also edited some js files in Joomla to be compatible with mootools 1.2 but hadn't the time to test them jet...
switcher.js
Code: Select all
var JSwitcher = new Class({
Implements: Options,
toggler : null, //holds the active toggler
page : null, //holds the active page
options : {
cookieName: 'switcher'
},
initialize: function(toggler, element, options)
{
this.setOptions(options);
var self = this;
togglers = toggler.getElements('a');
for (i=0; i < togglers.length; i++) {
togglers[i].addEvent( 'click', function() { self.switchTo(this); } );
}
//hide all
elements = element.getElements('div[id^=page-]');
for (i=0; i < elements.length; i++) {
this.hide(elements[i])
}
this.toggler = toggler.getElement('a.active');
this.page = $('page-'+ this.toggler.id);
this.show(this.page);
if (this.options.cookieName)
{
if((page = Cookie.read(this.options.cookieName))) {
this.switchTo($(page));
}
}
},
switchTo: function(toggler)
{
page = $chk(toggler) ? $('page-'+toggler.id) : null;
if(page && page != this.page)
{
//hide old element
if(this.page) {
this.hide(this.page);
}
//show new element
this.show(page);
toggler.addClass('active');
if (this.toggler) {
this.toggler.removeClass('active');
}
this.page = page;
this.toggler = toggler;
Cookie.write(this.options.cookieName, toggler.id);
}
},
hide: function(element) {
element.setStyle('display', 'none');
},
show: function (element) {
element.setStyle('display', 'block');
}
});
document.switcher = null;
window.addEvent('domready', function(){
toggler = $('submenu')
element = $('config-document')
if(element) {
document.switcher = new JSwitcher(toggler, element, {cookieName: toggler.getAttribute('class')});
}
});
Code: Select all
var JFormValidator = new Class({
initialize: function()
{
// Initialize variables
this.handlers = Object();
this.custom = Object();
// Default handlers
this.setHandler('username',
function (value) {
regex = new RegExp("[\<|\>|\"|\'|\%|\;|\(|\)|\&]", "i");
return !regex.test(value);
}
);
this.setHandler('password',
function (value) {
regex=/^\S[\S ]{2,98}\S$/;
return regex.test(value);
}
);
this.setHandler('numeric',
function (value) {
regex=/^(\d|-)?(\d|,)*\.?\d*$/;
return regex.test(value);
}
);
this.setHandler('email',
function (value) {
regex=/^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/;
return regex.test(value);
}
);
// Attach to forms with class 'form-validate'
var forms = $$('form.form-validate');
forms.each(function(form){ this.attachToForm(form); }, this);
},
setHandler: function(name, fn, en)
{
en = (en == '') ? true : en;
this.handlers[name] = { enabled: en, exec: fn };
},
attachToForm: function(form)
{
// Iterate through the form object and attach the validate method to all input fields.
$A(form.elements).each(function(el){
el = $(el);
if ((el.get('tag') == 'input' || el.get('tag') == 'button') && el.getProperty('type') == 'submit') {
if (el.hasClass('validate')) {
el.onclick = function(){return document.formvalidator.isValid(this.form);};
}
} else {
el.addEvent('blur', function(){return document.formvalidator.validate(this);});
}
});
},
validate: function(el)
{
// If the field is required make sure it has a value
if ($(el).hasClass('required')) {
if (!($(el).get('value'))) {
this.handleResponse(false, el);
return false;
}
}
// Only validate the field if the validate class is set
var handler = (el.className && el.className.search(/validate-([a-zA-Z0-9\_\-]+)/) != -1) ? el.className.match(/validate-([a-zA-Z0-9\_\-]+)/)[1] : "";
if (handler == '') {
this.handleResponse(true, el);
return true;
}
// Check the additional validation types
if ((handler) && (handler != 'none') && (this.handlers[handler]) && $(el).get('value')) {
// Execute the validation handler and return result
if (this.handlers[handler].exec($(el).get('value')) != true) {
this.handleResponse(false, el);
return false;
}
}
// Return validation state
this.handleResponse(true, el);
return true;
},
isValid: function(form)
{
var valid = true;
// Validate form fields
for (var i=0;i < form.elements.length; i++) {
if (this.validate(form.elements[i]) == false) {
valid = false;
}
}
// Run custom form validators if present
$A(this.custom).each(function(validator){
if (validator.exec() != true) {
valid = false;
}
});
return valid;
},
handleResponse: function(state, el)
{
// Find the label object for the given field if it exists
if (!(el.labelref)) {
var labels = $$('label');
labels.each(function(label){
if (label.getProperty('for') == el.getProperty('id')) {
el.labelref = label;
}
});
}
// Set the element and its label (if exists) invalid state
if (state == false) {
el.addClass('invalid');
if (el.labelref) {
$(el.labelref).addClass('invalid');
}
} else {
el.removeClass('invalid');
if (el.labelref) {
$(el.labelref).removeClass('invalid');
}
}
}
});
document.formvalidator = null;
Window.onDomReady(function(){
document.formvalidator = new JFormValidator();
});
- SqueezeBox (modal.js): http://digitarald.de/project/squeezebox/
- FancyUpload (swf.js and uploader.js): http://digitarald.de/project/fancyupload/
These maybe will also break some code (like mootools 1.2 does), but i haven't tested it jet.
- Tonie
- Joomla! Master
- Posts: 16553
- Joined: Thu Aug 18, 2005 7:13 am
Re: [12]Upgrade to mootools 1.2
The idea is that it will be for 1.6.