Skip to content

Instantly share code, notes, and snippets.

View andriasang's full-sized avatar

Anoop Gantayat andriasang

View GitHub Profile
var Widget = new Class({
Implements: Options,
options: {
color: '#fff',
size: {
width: 100,
height: 100
}
},
initialize: function(options){
class MyClass extends Configurable {
protected static $_defaults = array (
"option1" => "blah blah blah",
"option2" => 35,
"option3" => true
);
public function __construct($param, $options = null)
{
/*
* Base class for configurable classes
* Based off a class that was included with the Solarium library
* This new version lets you declare defaults which are inherited down the inheritance tree
*
* All classes extending this class are configurable using the constructor or setOption calls.
*
*/
class Configurable
{
Behavior.addGlobalFilters ({
AnimatedAnchor: {
defaults: {
duration: 'short',
transition: 'quad:in:out'
},
setup: function (link, api) {
window.addEvent('domready', function () {
Behavior.addGlobalFilters ({
LinkHijack: {
defaults: {
"text": "Default Text", // the text you want output
"useAlert": false, // false to use console, true to use alert
"preventDefault": true // true to make hijacked link stop from proceding
window.addEvent('domready', function () {
Behavior.addGlobalFilters ({
LinkHijack: {
setup: function (elem, api) {
elem.addEvent ("click", function (e) {
e.preventDefault();
console.log ("Ooga Booga");
}
window.addEvent('domready', function () {
document.getElementById("sillylink").addEvent ("click", function (e) {
e.preventDefault();
console.log ("ooga booga");
}
}