Discuss or ask a question
Using a fanquery plugin
Make sure you have gone through this example on how to use fanquery. This page builds on that.
Note: There are no plugins as of now except the two plugins created for experimentation. I will add more. If you want to help me Here's how you write a plugin(it's really really simple)
Anyhow, this is how you use a plugin (for eg., 'fancybox'):
1) Install fancybox like this
fanr install -r http://repo.talesframework.org:9000 fancybox
Note: Tales has an optimization mechanism to include only plugins required per page to be delivered with the page. Hence you need to tell tales per page on what plugins it uses.
For eg., This example
2) Open fan/Jq.fan and make Jq class extend the plugin class. For eg., to include the Fancybox plugin, modify the Jq class as below
using fanquery
using fancybox

@Js
class Jq : JqBase, FancyBox{
  new make(Obj? selector, JqBase? context := null)
      : super(selector, context){}
}
3) Now open IndexJs.fan and add the @Include facet to declare what plugins you use. (This is necessary because otherwise tales will have to include scripts for all plugins in every page)
using fanquery

  @Js
  @Include{ plugins =[
        Plugin{name="fancybox"; conf=["easing":true]}
     ]
  }
  class IndexJs{
    ...
  }
Take a look at @Include facet. You define the name of the pod that defines the plugin and some conf. you can omit "conf" if it's not required by plugin. Based on the "conf" parameter the plugin can load additional scripts.
4) The Jq class inherits all methods from extended plugins. For eg., if you just extended, fancybox mixin you can do :
Jq("link").fancybox
Done.