Re: [xwiki-users] jQuery plugin - Conflict with prototype.js

2014-01-08 Thread Ruben M.
Hi Caleb,

 

Finally some good news concerning require.js and my plugin. It is working 
although it's only possible when I include the metrojs-code in the page itself. 
(

Re: [xwiki-users] jQuery plugin - Conflict with prototype.js

2013-12-18 Thread Caleb James DeLisle
Hi Ruben,

If you're wrapping the metrojs script in a
require(['jquery'], function($) {  })
call then I'm not sure there much else you can do other than manually searching
through metrojs and hunting down the places where it uses window.$ which
defeats the wrapper.

Sorry I couldn't bring better news.

Thanks,
Caleb


On 12/18/2013 02:24 PM, Ruben M. wrote:
> Hi Caleb,
> 
> After several tries i gave up on the requirejs-implementation in Xwiki. For
> me, it seems like jQuery plugins also use $ for their functions, but are not
> beeing connected to jQuery although inside the require-function. (in this
> case: "$(...).liveTile() is not a function.") 
> 
> I saw your documentation on
> http://platform.xwiki.org/xwiki/bin/view/DevGuide/JavaScriptAPI, thanks for
> that. Do you (or anyone else) know a Xwiki-page where i can analyze a
> working jQuery plugin with $-functions?
> I'm not sure about whether to use shim, map, registrating the metrojs as a
> module or none of that.
> 
> Thanks & regards
> Ruben
> 
> 
> 
> --
> View this message in context: 
> http://xwiki.475771.n2.nabble.com/jQuery-plugin-Conflict-with-prototype-js-tp7588243p7588424.html
> Sent from the XWiki- Users mailing list archive at Nabble.com.
> ___
> users mailing list
> users@xwiki.org
> http://lists.xwiki.org/mailman/listinfo/users
> 
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] jQuery plugin - Conflict with prototype.js

2013-12-18 Thread Ruben M.
Hi Caleb,

After several tries i gave up on the requirejs-implementation in Xwiki. For
me, it seems like jQuery plugins also use $ for their functions, but are not
beeing connected to jQuery although inside the require-function. (in this
case: "$(...).liveTile() is not a function.") 

I saw your documentation on
http://platform.xwiki.org/xwiki/bin/view/DevGuide/JavaScriptAPI, thanks for
that. Do you (or anyone else) know a Xwiki-page where i can analyze a
working jQuery plugin with $-functions?
I'm not sure about whether to use shim, map, registrating the metrojs as a
module or none of that.

Thanks & regards
Ruben



--
View this message in context: 
http://xwiki.475771.n2.nabble.com/jQuery-plugin-Conflict-with-prototype-js-tp7588243p7588424.html
Sent from the XWiki- Users mailing list archive at Nabble.com.
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] jQuery plugin - Conflict with prototype.js

2013-12-05 Thread Caleb James DeLisle
Actually IIRC you reminded me that I has not documented it and I decided
to put off documenting it because it was new and might change/break
(which it did in 5.1). Now I think you're right and we have reached a
point where it is safe for people to begin using it so I will write some
documentation on it.

Thanks,
Caleb


On 12/04/2013 05:51 PM, vinc...@massol.net wrote:
> BTW might be a good time to document the requirejs feature in XWiki Caleb? 
> (You forgot to do so when you introduced it, you only added it in the release 
> notes but not in the documentation) :)
> 
> Thanks
> -Vincent
> 
> On 4 Dec 2013 at 17:33:08, Ruben M. (r.muel...@kraeuterhaus.de) wrote:
> 
> Hi Caleb, 
> 
> Thanks for your quick answer. 
> 
> Thanks for your hint with require.js, it seems to be an interesting concept, 
> though it might be beyond my js-skills :-) But i think i'll give it a try. 
> 
> I found the following code at stackoverflow: 
> 
> (function (factory) { 
> if (typeof define === 'function' && define.amd) { 
> // AMD. Register as an anonymous module. 
> define(['jquery'], factory); 
> } else { 
> // Browser globals 
> factory(jQuery); 
> } 
> }(function ($) { 
> 
> $.fn.jqueryPlugin = function () { 
> // Put your plugin code here 
> }; 
> 
> })); 
> 
> Is it enough to create a js-File like that and register it in the 
> javascript.vm under 'paths:', or do i have to change more things in that 
> file or somewhere else? (produced errors so far...) 
> I found something about jquery in the require.js in the js-folder. 
> 
> Regards, 
> Ruben 
> 
> 
> 
> ___
> users mailing list
> users@xwiki.org
> http://lists.xwiki.org/mailman/listinfo/users
> 
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] jQuery plugin - Conflict with prototype.js

2013-12-04 Thread vinc...@massol.net
BTW might be a good time to document the requirejs feature in XWiki Caleb? (You 
forgot to do so when you introduced it, you only added it in the release notes 
but not in the documentation) :)

Thanks
-Vincent

On 4 Dec 2013 at 17:33:08, Ruben M. (r.muel...@kraeuterhaus.de) wrote:

Hi Caleb, 

Thanks for your quick answer. 

Thanks for your hint with require.js, it seems to be an interesting concept, 
though it might be beyond my js-skills :-) But i think i'll give it a try. 

I found the following code at stackoverflow: 

(function (factory) { 
if (typeof define === 'function' && define.amd) { 
// AMD. Register as an anonymous module. 
define(['jquery'], factory); 
} else { 
// Browser globals 
factory(jQuery); 
} 
}(function ($) { 

$.fn.jqueryPlugin = function () { 
// Put your plugin code here 
}; 

})); 

Is it enough to create a js-File like that and register it in the 
javascript.vm under 'paths:', or do i have to change more things in that 
file or somewhere else? (produced errors so far...) 
I found something about jquery in the require.js in the js-folder. 

Regards, 
Ruben 



___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] jQuery plugin - Conflict with prototype.js

2013-12-04 Thread Ruben M.
Hi Caleb,

Thanks for your quick answer.

Thanks for your hint with require.js, it seems to be an interesting concept,
though it might be beyond my js-skills :-) But i think i'll give it a try. 

I found the following code at stackoverflow:

(function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['jquery'], factory);
} else {
// Browser globals
factory(jQuery);
}
}(function ($) {

$.fn.jqueryPlugin = function () {
// Put your plugin code here
};  

}));

Is it enough to create a js-File like that and register it in the
javascript.vm under 'paths:', or do i have to change more things in that
file or somewhere else? (produced errors so far...)
I found something about jquery in the require.js in the js-folder.

Regards,
Ruben







--
View this message in context: 
http://xwiki.475771.n2.nabble.com/jQuery-plugin-Conflict-with-prototype-js-tp7588243p7588260.html
Sent from the XWiki- Users mailing list archive at Nabble.com.
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] jQuery plugin - Conflict with prototype.js

2013-12-04 Thread Caleb James DeLisle
Hi Ruben,

On 12/04/2013 12:10 PM, Ruben M. wrote:
> Hello XWiki team & users,
> 
> First of all thanks a lot for your great work. 
> 
> I’ve set up XWiki as an intranet website (version 5.2.1).
> Currenty I’m trying to customize it with some javascript to make life easier
> for the users.
> 
> I experimented a bit with jQuery (as I have a bit of experience with it) and
> have successfully integrated it into a test page via the jQuery Helpers
> Extension
> (http://extensions.xwiki.org/xwiki/bin/view/Extension/jQuery+Helpers)
> Now I want to include a jQuery Plugin which extends the jQuery functions.
> I’d like to try out the live tiles in Windows 8 style from Drew Greenwell
> (http://www.drewgreenwell.com/projects/metrojs).
> 
> It’s no big deal to get the liveTiles working - On a local webserver without
> Xwiki.
> Here’s the problem: The functions from metrojs seem to collide with
> prototype.js. I experimented a bit with jQuerynoConflict(); , I tried to
> rename the functions inside metroJS.js, but nothing worked so far.
> Firebug says ‘$ele.attr is not a function’ inside the metrojs-Code in the
> console, which I believe is a problem with prototype.js. (See for the XWiki
> test page code at the end of the mail – I won’t post the whole MetroJS-Code
> here, it’s a little big).
> 
> My questions are: 
> a)Is there a possibility to deactivate / rename / “defuse” prototype.js, 
> or
> to listen for another shortcut than $ on this page (something like
> prototypeNoConflict();) ?


No, prototype is not really able to do this and much of XWiki and extension js
depends on $ being bound to prototype.


> b)Has anyone of you any experience with jQuery plugins (or even better,
> Metrojs!) in XWiki and maybe a hint?


I have experience with jquery, as of XWiki 5.2 you can access that using 
requirejs.
require(['jquery'], function ($) {   $('#xwikicontent').append('hello 
world') });

I recommend wrapping metrojs in a similar function to avoid conflicts while
still giving it access to jquery as it requires.


> c)Is there a possibility of producing some kind of “liveTiles” with
> prototype.js (which I’m not very experienced with)

prototype is (gingerly) moving toward retirement and the best support will
always be found in the jQuery world.
http://sstephenson.us/posts/you-are-not-your-code


Thanks,
Caleb


> 
> I know it’s more of a javascript-related question, so thanks a lot for
> reading this anyway.
> 
> Regards
> Ruben
> 
> #
> 
> Here’s the current code of my test page (ADMIN is the test space):
> 
> {{velocity}}
> $xwiki.jsx.use("jQuery.jQuery", {'defer': false})
> $xwiki.jsx.use("ADMIN.MetroJS")
> $xwiki.ssx.use("ADMIN.MetroCSS")
> {{/velocity}}
> 
> 
> {{html}}
> Carousel Mode: Simple
> 
> 
>  class="live-tile" data-direction="horizontal" data-delay="3000">
>   
>   
> 2 and a
> half
>   
>   
> 
> 
> 
> 
> 
> {{/html}}
> 
> 
> 
> 
> 
> --
> View this message in context: 
> http://xwiki.475771.n2.nabble.com/jQuery-plugin-Conflict-with-prototype-js-tp7588243.html
> Sent from the XWiki- Users mailing list archive at Nabble.com.
> ___
> users mailing list
> users@xwiki.org
> http://lists.xwiki.org/mailman/listinfo/users
> 
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


[xwiki-users] jQuery plugin - Conflict with prototype.js

2013-12-04 Thread Ruben M.
Hello XWiki team & users,

First of all thanks a lot for your great work. 

I’ve set up XWiki as an intranet website (version 5.2.1).
Currenty I’m trying to customize it with some javascript to make life easier
for the users.

I experimented a bit with jQuery (as I have a bit of experience with it) and
have successfully integrated it into a test page via the jQuery Helpers
Extension
(http://extensions.xwiki.org/xwiki/bin/view/Extension/jQuery+Helpers)
Now I want to include a jQuery Plugin which extends the jQuery functions.
I’d like to try out the live tiles in Windows 8 style from Drew Greenwell
(http://www.drewgreenwell.com/projects/metrojs).

It’s no big deal to get the liveTiles working - On a local webserver without
Xwiki.
Here’s the problem: The functions from metrojs seem to collide with
prototype.js. I experimented a bit with jQuerynoConflict(); , I tried to
rename the functions inside metroJS.js, but nothing worked so far.
Firebug says ‘$ele.attr is not a function’ inside the metrojs-Code in the
console, which I believe is a problem with prototype.js. (See for the XWiki
test page code at the end of the mail – I won’t post the whole MetroJS-Code
here, it’s a little big).

My questions are: 
a)  Is there a possibility to deactivate / rename / “defuse” prototype.js, 
or
to listen for another shortcut than $ on this page (something like
prototypeNoConflict();) ?
b)  Has anyone of you any experience with jQuery plugins (or even better,
Metrojs!) in XWiki and maybe a hint?
c)  Is there a possibility of producing some kind of “liveTiles” with
prototype.js (which I’m not very experienced with)

I know it’s more of a javascript-related question, so thanks a lot for
reading this anyway.

Regards
Ruben

#

Here’s the current code of my test page (ADMIN is the test space):

{{velocity}}
$xwiki.jsx.use("jQuery.jQuery", {'defer': false})
$xwiki.jsx.use("ADMIN.MetroJS")
$xwiki.ssx.use("ADMIN.MetroCSS")
{{/velocity}}


{{html}}
Carousel Mode: Simple



  
  
2 and a
half
  
  





{{/html}}





--
View this message in context: 
http://xwiki.475771.n2.nabble.com/jQuery-plugin-Conflict-with-prototype-js-tp7588243.html
Sent from the XWiki- Users mailing list archive at Nabble.com.
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users