aboutsummaryrefslogtreecommitdiffstats
path: root/demos/functional/js
diff options
context:
space:
mode:
Diffstat (limited to 'demos/functional/js')
-rw-r--r--demos/functional/js/behaviour.functionaldemos.js4
-rw-r--r--demos/functional/js/behaviour.js44
-rw-r--r--demos/functional/js/functional.demo.js68
3 files changed, 58 insertions, 58 deletions
diff --git a/demos/functional/js/behaviour.functionaldemos.js b/demos/functional/js/behaviour.functionaldemos.js
index 46ed6c97b..b7aa37c1c 100644
--- a/demos/functional/js/behaviour.functionaldemos.js
+++ b/demos/functional/js/behaviour.functionaldemos.js
@@ -1,9 +1,9 @@
$(document).ready(function() {
-
+
$('.component-links a').history(function() {
loadDemo( $(this).attr('href').replace(/^#/, "") );
});
$.ajaxHistory.initialize();
-
+
}); \ No newline at end of file
diff --git a/demos/functional/js/behaviour.js b/demos/functional/js/behaviour.js
index 35ea2b060..3cafacb39 100644
--- a/demos/functional/js/behaviour.js
+++ b/demos/functional/js/behaviour.js
@@ -1,21 +1,21 @@
$(document).ready(function() {
-
+
// link demos
-
+
$(".demoflow div.wrapper").click(function() {
-
+
var demo = $(this).children('img').attr('_demo');
-
+
if (demo) {
location.href = '/repository/real-world/' + demo;
}else {
//alert('Under construction!');
}
-
+
});
-
+
if ($("div.demoflow").size()) {
-
+
var inst = new $.ui.carousel($("div.demoflow")[0], { height: 200, width: 310 });
$("div.demoflow-button-left, div.demoflow-button-right").bind("mousedown", function() {
@@ -26,14 +26,14 @@ $(document).ready(function() {
.bind("mouseup", function() {
window.clearInterval(inst.timer);
});
-
+
$('.demoflow div.shadow').hover(function() {
this._lastopacity = $(this).css('opacity');
$(this).stop().animate({opacity: 0 }, 300);
}, function() {
$(this).stop().animate({opacity: this._lastopacity }, 300);
});
-
+
window.setTimeout(function() {
inst.element.animate({ opacity: 1 },2000); inst.rotate(0,2000,0.45);
@@ -47,13 +47,13 @@ $(document).ready(function() {
$('a').click(function(){
this.blur();
});
-
+
// smooth hover effects by DragonInteractive
var hover = hoverEffects();
hover.init();
});
-
+
$.ui.carousel = function(element, options) {
this.element = $(element);
@@ -68,41 +68,41 @@ $(document).ready(function() {
paddingX: this.element.outerWidth() / 2,
paddingY: this.element.outerHeight() / 2
});
-
+
$("> *", this.element).css({ position: "absolute", top: 0, left: 0, zIndex: 1 });
this.rotate();
this.rotate("right");
-
+
this.element.parent().bind("mousewheel", function(event ,delta) {
if(self.autoRotator) window.clearInterval(self.autoRotator);
self.rotate(delta < 0 ? "right" : "left");
return false;
});
-
+
};
-
+
$.ui.carousel.prototype.rotate = function(d,ani,speed) {
this.start = this.start + (d == "right" ? -(speed || 0.03) : (speed || 0.03));
var o = this.options;
var self = this;
-
+
setTimeout(function(){
$("> *", self.element).each(function(i) {
var angle = self.start + i * self.step;
var x = self.radiusX * Math.cos(angle);
var y = self.radiusY * Math.sin(angle);
var _self = this;
-
+
var width = o.width * ((self.radiusY+y) / (2 * self.radiusY));
width = (width * width * width) / (o.width * o.width); //This makes the pieces smaller
var height = parseInt(width * o.height / o.width);
-
+
//This is highly custom - it will hide the elements at the back
$(_self).css({ visibility: height < 30 ? "hidden" : "visible" });
if(height < 30 && !ani) return; //This imrpoves the speed, but cannot be used with animation
-
-
+
+
if(ani) {
$(_self).animate({
top: Math.round(self.paddingY + y - height/2) + "px",
@@ -122,7 +122,7 @@ $(document).ready(function() {
}
$("div.shadow",_self).css({ opacity: 1 - (width / o.width) });
-
+
});
}, 0);
}
@@ -200,6 +200,6 @@ var hoverEffects = function() {
})
}
};
-
+
return self;
}; \ No newline at end of file
diff --git a/demos/functional/js/functional.demo.js b/demos/functional/js/functional.demo.js
index 5128d12a6..434316949 100644
--- a/demos/functional/js/functional.demo.js
+++ b/demos/functional/js/functional.demo.js
@@ -6,38 +6,38 @@ var uid = 0;
* @param {Object} model
*/
var uiRenderDemo = function(model) {
-
+
var title = model.title, renderAt = $(model.renderAt);
-
+
function nl2br( str ) {
return str.replace(/([^>])\n/g, '$1<br />\n');
}
-
+
var js2html = function(code) {
var src = (js_beautify(code) || "");
-
+
//if ($.browser.msie)
// src = src.replace(/([^>])\n/g, '$1<br />\n');
-
+
return src;
};
-
+
renderAt.append(
'<h3>'+ title +'</h3>'
);
$.each(model.demos, function(i, demo) {
-
+
/**
* Rendering each demo
*/
if (!demo) return;
-
+
var uiHtmlRendered = $('<div class="ui-html-rendered"></div>');
-
+
if (model.onRenderStart) model.onRenderStart.apply(window);
-
+
var gid = 'ui-gen-'+uid++, demoBox = $('<div id="'+gid+'"></div>');
renderAt.append(demoBox);
@@ -45,15 +45,15 @@ var uiRenderDemo = function(model) {
var detailsHtml = $(
'<br><div class="ui-details"><div class="menutitle">'+demo.title+'</div></div>'
);
-
+
var descBox = $(
'<div class="ui-demo-description">'+(demo.desc||'')+'</div>'
);
-
+
var optionsBox = $(
'<div class="ui-demo-options"><label for="select-'+gid+'">Try more options on the fly: </label></div>'
);
-
+
var codesBox = $(
'<div id="code-'+gid+'"></div>'
)
@@ -62,19 +62,19 @@ var uiRenderDemo = function(model) {
var sourceTmpl = $(
'<div></div>'
);
-
+
var preTmpl = $(
'<span style="white-space: pre;"></span>'
);
-
+
var codeTmpl = $(
'<code></code>'
);
-
+
var htmlCode = '', sourceHtml = sourceTmpl.clone(), sourceJs = sourceTmpl.clone(), entitiesHtml = function(html) {
return html.replace(/</g,"&lt;").replace(/>/g,"&gt;");
};
-
+
// Render simple HTML
if (typeof demo.html == 'string') {
uiHtmlRendered.html(demo.html);
@@ -82,9 +82,9 @@ var uiRenderDemo = function(model) {
}
// Render data html by URL
if (typeof demo.html == 'object' && demo.html.url) {
-
+
uiHtmlRendered.html("<img src='/images/ajax-loader.gif'>");
-
+
$.ajax({
type: "GET",
url: demo.html.url,
@@ -92,26 +92,26 @@ var uiRenderDemo = function(model) {
success: function(data) {
uiHtmlRendered.html(data);
htmlCode = data;
-
+
// set html code view
sourceHtml.html(preTmpl.clone().html( codeTmpl.clone().addClass('colored html').html(entitiesHtml(htmlCode)) ));
-
+
$.each(demo.options, function(x, o) {
// eval the first source of <select>
if (!x) jQuery.globalEval(o.source);
});
-
+
$('#'+gid).find('.colored.html').chili();
-
+
// fire renderEnd callback to ajax async transactions
if (model.onRenderEnd) model.onRenderEnd.apply(window);
}
});
-
+
}
// set html code view
sourceHtml.html(preTmpl.clone().html( codeTmpl.clone().addClass('colored html').html(entitiesHtml(htmlCode)) ));
-
+
var select = $('<select id="select-'+ gid+'"></select>').change(function() {
var ecode = decodeURIComponent($(this).val());
@@ -137,7 +137,7 @@ var uiRenderDemo = function(model) {
select, a, '<br>', codesBox.append('<br>JavaScript:<br>', sourceJs, '<br>HTML:<br>', sourceHtml)
)
);
-
+
// population select with the demo options
$.each(demo.options, function(x, o) {
if (o && o.desc) {
@@ -150,28 +150,28 @@ var uiRenderDemo = function(model) {
}
}
});
-
+
$('#'+gid).find('.colored.javascript').chili();
$('#'+gid).find('.colored.html').chili();
-
+
// fire renderEnd callback to direct-html-render
if (typeof demo.html != 'object' && model.onRenderEnd) model.onRenderEnd.apply(window);
-
+
});
};
var loadDemo = function(comp) {
-
+
$("#dialog").dialog().remove();
-
+
$('#containerDemo').html("<img src='images/ajax-loader.gif'>");
-
+
$("#containerDemo").ajaxError(function(request, settings){
$(this).html("Oops, there is no template file for this component.");
});
-
+
$.get('templates/'+comp+'.html', function(data) {
$('#containerDemo').html(data);
});
-
+
}; \ No newline at end of file