Language: JavaScript
Untitled JavaScript (17-Feb @ 17:31)
Syntax Highlighted Code
- // comment scroll
- var $form = $('#new_comment');
- if ( $form.length ) {
- var offset = $form.offset(),
- [39 more lines...]
Plain Code
// comment scroll
var $form = $('#new_comment');
if ( $form.length ) {
var offset = $form.offset(),
offsetTop = offset.top, offsetLeft = offset.left,
fixedPos = false, timeout;
$(window).bind('resize', function(event) {
if ( timeout ) clearTimeout(timeout);
timeout = setTimeout(resize, 50);
function resize() {
$form.css({
position: 'relative',
top: 0,
left: 0,
width: ''
});
offsetLeft = $form.offset().left;
fixedPos = false;
$(window).scroll();
}
});
$(window).bind('scroll', function(event) {
var scrollTop = $(this).scrollTop(),
diff = scrollTop - offsetTop;
if ( diff > -20 && !fixedPos ) {
$form.css({
position: 'fixed',
top: 20,
width: $form.width(),
left: offsetLeft
});
fixedPos = true;
} else if ( diff < -20 && fixedPos ) {
$form.css({
position: 'relative',
top: 0,
left: 0,
width: ''
});
fixedPos = false;
}
}).scroll();
}
Untitled JavaScript (17-Feb @ 17:30)
Syntax Highlighted Code
- (function( $ ) {
- // http://codedumper.com/azoku
- [47 more lines...]
Plain Code
(function( $ ) {
// http://codedumper.com/azoku
var win = $( window ),
winTop,
elems = [],
bound = false;
function normalize( val ) {
return $.isFunction( val ) ? val() : val;
}
function position() {
var currentTop = this.elem.offset().top,
options = this.options,
min = normalize( options.min );
if ( windowTop > min || currentTop > min ) {
var top = Math.max( windowTop, min );
if ( options.max ) {
top = Math.min( top, normalize(options.max) );
}
this.elem.stop().animate({
top: top
}, 200);
}
}
$.fn.floatFixed = function( options ) {
options = $.extend( { min: "auto" }, options );
// TODO: make this work with multiple elements
if ( options.min === "auto" ) {
options.min = self.offset().top;
}
this.each(function() {
elems.push({ elem: $(this), options: options });
});
if ( !bound ) {
win.scroll(function() {
windowTop = win.scrollTop();
$.each( elems, position );
});
}
return this;
};
})( jQuery );
Untitled JavaScript (17-Feb @ 03:11)
Syntax Highlighted Code
- $.each({
- prevOf: "previousSibling",
- nextOf: "nextSibling"
- }, function( method, traversal ) {
- [10 more lines...]
Plain Code
$.each({
prevOf: "previousSibling",
nextOf: "nextSibling"
}, function( method, traversal ) {
$.fn[ method ] = function( selector ) {
return this.pushStack( this.map(function() {
var ret = this[ traversal ];
while ( ret && !$( ret ).is( selector ) ) {
ret = ret[ traversal ];
}
return ret;
}) );
};
});
Untitled JavaScript (15-Feb @ 20:38)
Syntax Highlighted Code
- .menu({
- focus: function( event, ui ) {
- var item = ui.item.data( "item.autocomplete" );
- if ( false !== self._trigger( "focus", null, { item: item } ) ) {
- [17 more lines...]
Plain Code
.menu({
focus: function( event, ui ) {
var item = ui.item.data( "item.autocomplete" );
if ( false !== self._trigger( "focus", null, { item: item } ) ) {
// use value to match what will end up in the input
self.element.val( item.value );
}
},
selected: function( event, ui ) {
var item = ui.item.data( "item.autocomplete" );
if ( false !== self._trigger( "select", event, { item: item } ) ) {
self.element.val( item.value );
}
self.close( event );
self.previous = self.element.val();
// only trigger when focus was lost (click on menu)
if ( self.element[0] != document.activeElement ) {
self.element.focus();
}
}
})
Untitled JavaScript (11-Feb @ 19:15)
Syntax Highlighted Code
- $.fn.fuckingAwesome = function( options ) {
- var self = this,
- win = $( window );
- options = $.extend( { min: 0 }, options );
- [15 more lines...]
Plain Code
$.fn.fuckingAwesome = function( options ) {
var self = this,
win = $( window );
options = $.extend( { min: 0 }, options );
if ( options.min === "auto" ) { options.min = self.offset().top; }
win.bind( "scroll resize", function() {
var windowTop = win.scrollTop(),
currentTop = self.offset().top;
if ( windowTop > options.min || currentTop > options.min ) {
var top = Math.max( windowTop, options.min );
if ( options.max ) {
top = Math.min( top, $.isFunction(options.max) ? options.max() : options.max );
}
self.stop().animate({
top: top
}, 200);
}
});
};
google cdn (10-Feb @ 13:17)
Syntax Highlighted Code
- <script type="text/javascript" src="http://www.google.com/jsapi"></script>
- <script type="text/javascript">
- google.load("jquery", "1.3");
- </script>
Plain Code
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("jquery", "1.3");
</script>
Untitled JavaScript (2-Feb @ 12:38)
Syntax Highlighted Code
- function bob ()
- {
- var touch;
- }
Plain Code
function bob ()
{
var touch;
}
Untitled JavaScript (2-Feb @ 01:08)
Syntax Highlighted Code
- ///////////////////////////////////////////////
- // autoscroll
- ///////////////////////////////////////////////
- [54 more lines...]
Plain Code
///////////////////////////////////////////////
// autoscroll
///////////////////////////////////////////////
// first hide the navigation buttons
var $buttons = $('img.right').add('img.left').hide();
// start to automatically cycle the tabs
cycleTimer = setInterval(function () {
$scroll.trigger('next');
}, 5000); // how many milliseconds, change this to whatever you like
// select some trigger elements to stop the auto-cycle
var $stopTriggers = $('#slider .navigation').find('a') // tab headers
.add('.scroll') // panel itself
.add('.stopscroll') // links to the stop class div
.add('.navigation') // links to navigation id for tabs
.add("a[href^='#']"); // links to a tab
// this is the function that will stop the auto-cycle
function stopCycle() {
// remove the no longer needed stop triggers
clearInterval(cycleTimer); // stop the auto-cycle itself
$buttons.show(); // show the navigation buttons
document.getElementById('stopscroll').style.display='none'; // hide the stop div
document.getElementById('startscroll').style.display='block'; // block the start div
}
// bind stop cycle function to the click event using namespaces
$stopTriggers.bind('click.cycle', stopCycle);
///////////////////////////////////////////////
// end autoscroll
///////////////////////////////////////////////
// edit to start again
///////////////////////////////////////////////
// select some trigger elements to stop the auto-cycle
var $startTriggers_start = $('#slider .navigation').find('a') // tab headers
.add('.startscroll'); // links to the start class div
// this is the function that will stop the auto-cycle
function startCycle() {
// remove the no longer needed stop triggers
$buttons.hide(); // show the navigation buttons
$scroll.trigger('next'); // directly to the next first
cycleTimer = setInterval(function () { // now set timer again
$scroll.trigger('next');
}, 5000); // how many milliseconds, change this to whatever you like
document.getElementById('stopscroll').style.display='block'; // block the stop div
document.getElementById('startscroll').style.display='none'; // hide the start div
}
// bind stop cycle function to the click event using namespaces
$startTriggers_start.bind('click.cycle', startCycle);
///////////////////////////////////////////////
// end edit to start
///////////////////////////////////////////////
JQuery Autocomplete (parse method) JSON Object (1-Feb @ 15:20)
Syntax Highlighted Code
- <script>
- $(function() {
- $.ajaxSetup ({ cache: false });
- var ajaxLoadingImg = '<img
- [42 more lines...]
Plain Code
<script>
$(function() {
$.ajaxSetup ({ cache: false });
var ajaxLoadingImg = '<img
src='${Url.Content("/content")}/img/ui/icons/spinner1.gif' />';
$("#select1").attr("disabled", "disabled");
//Multiple select option cloning
$('#add').click(function() {
return !$('#select1 option:selected').remove().appendTo('#select2');
});
$('#remove').click(function() {
return !$('#select2 option:selected').remove().appendTo('#select1');
});
//Autocomplete
$("#instrument").autocomplete("/RegulatorSet/InstrumentSearchAutocomplete", {
delay: 150, // millisecond delay after keyup/down event
minChars: 2, // min no of chars to activate
mustMatch: false,
max: 100, // max no of items
dataType: 'json',
parse: function(json) {
var resultList = new Array();
$("#instrument").after('<span class="ajax-load">' + ajaxLoadingImg
+ 'Loading Insrument Group' + '</span>');
var optionsHtml = '';
for(var i=0; i<json.length; i++){
optionsHtml += '<option value="' + json[i].optionValue + '">' +
json[i].optionDisplay + '</option>';
}
$("#select1").removeAttr("disabled");
$("span.ajax-load").remove();
$("#select1").html(optionsHtml);
return resultList;
},
formatItem: function(resultList){
// No ul required
}
});
});
</script>
Untitled JavaScript (30-Jan @ 01:55)
Syntax Highlighted Code
- var monEffet = new Fx.Styles('chainTest');
- var legend = $('monitor');
- legend.setText("[ Début ]");
- [27 more lines...]
Plain Code
var monEffet = new Fx.Styles('chainTest');
var legend = $('monitor');
legend.setText("[ Début ]");
monEffet.start({ width:'200px' }).chain(
function() {
// Etape 1
legend.setText("-] Etape 1 ...");
monEffet.start({ 'background-color':'#BF2', color:'#000'});
}
).chain (
function(){
;// Etape 2
legend.setText("-]] Etape 2 ...");
monEffet.start.delay( 1000, monEffet,{ opacity:0 });
}
).chain (
function(){
// Etape 3
legend.setText("-]]] Etape 3 ...");
monEffet.start.delay( 3000, monEffet,{ 'background-color':'#0C3', color:'#fff', opacity:1 });
}
).chain (
function(){
// Fin
legend.setText("[ Fin ]");
if (confirm("T'as compris le chainage ?")) $('chainTest').setText("Eh ben t'es fort !");
else $('chainTest').setText("Concentre toi et relance l'animation !");
legend.setText("Lancez la chaine d'exécution en cliquant ici");
}
);
polling example (28-Jan @ 13:22)
Syntax Highlighted Code
- google.load("jquery", "1");
- google.setOnLoadCallback(
- function() {
- [47 more lines...]
Plain Code
google.load("jquery", "1");
google.setOnLoadCallback(
function() {
$(document).ready(function() { T.poll(); });
}
);
var T = { };
T.poll = function () {
var args = {};
$.ajax({
url: "/updates",
type: "POST",
dataType: "json",
data: $.param(args),
success: T.new_tweets
});
};
T.new_tweets = function(response) {
// die!
$('.top, .bottom').remove();
var wrapper = document.getElementById('wrapper');
wrapper.innerHTML = "<div id='header'></div>";
for (var i = 0; i < response.stats.length; ++i) {
var classname = "bottom";
if (i < 3)
classname = "top";
wrapper.innerHTML += "<div class='" + classname + "'>" +
"<h1>" + response.stats[i].k + "</h1>" +
"<h2>" + response.stats[i].v + "</h2>" +
(response.stats[i].t ?
"<span class='time'>since " + response.stats[i].t + "</span>" : '') +
"</div>";
}
T.poll();
};
//JSON
{"stats": [{"k": "ipad", "t": "1:05 pm", "v": 154374}, {"k": "apple", "t": "1:05 pm", "v": 104300}, {"k": "tablet", "t": "1:05 pm", "v": 45615}, {"k": "#ipad", "t": "2:55 pm", "v": 34730}, {"k": "iphone", "t": "1:05 pm", "v": 16207}, {"k": "mac", "t": "1:05 pm", "v": 14465}, {"k": "ipod", "t": "1:05 pm", "v": 8416}, {"k": "apps", "t": "1:05 pm", "v": 8024}, {"k": "iSlate", "t": "1:05 pm", "v": 4648}, {"k": "slate", "t": "1:05 pm", "v": 3372}, {"k": "steve jobs", "t": "1:05 pm", "v": 1409}, {"k": "itunes", "t": "1:05 pm", "v": 1238}, {"k": "itablet", "t": "1:05 pm", "v": 1074}, {"k": "iwork", "t": "1:53 pm", "v": 515}, {"k": "ibooks", "t": "2:31 pm", "v": 433}, {"k": "cupertino", "t": "1:12 pm", "v": 15}, {"k": "jesus tablet", "t": "1:08 pm", "v": 11}, {"k": "sjobs", "t": "1:35 pm", "v": 10}, {"k": "moses tablet", "t": "1:08 pm", "v": 9}, {"k": "jesus phone", "t": "3:48 pm", "v": 4}]}
Untitled JavaScript (24-Jan @ 18:56)
Syntax Highlighted Code
- alert("tjis will bring an alert window wih this message and OK button");
Plain Code
alert("tjis will bring an alert window wih this message and OK button");
Build Options html from json response (18-Jan @ 14:35)
Syntax Highlighted Code
- //return JSON Object
- $.getJSON(selectedInstrumentAjaxCallUrl, {instrument:ticker}, function(json) {
- //build options html
- var optionsHtml = '';
- [10 more lines...]
Plain Code
//return JSON Object
$.getJSON(selectedInstrumentAjaxCallUrl, {instrument:ticker}, function(json) {
//build options html
var optionsHtml = '';
for (var i = 0; i < json.length; i++) {
optionsHtml += '<option value="' + json[i].optionValue + '">' + json[i].optionDisplay + '</option>';
}
$("#select1").html(optionsHtml);
$("span.ajax-load").remove();
$("#select1").removeAttr("disabled");
$('#select1 option:first').attr('selected', 'selected');
})
})
Untitled JavaScript (14-Jan @ 13:32)
Syntax Highlighted Code
- <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
- <script type="text/javascript">
- $(document).ready(function(){
- [11 more lines...]
Plain Code
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$.getJSON("http://revvnation.com/forum/get_announcements.php?jsoncallback=?",function(data){
for(i in data)
{
if(data[i]['title']) $('#latest-announcements').append('<li>'+data[i]['title']+'</li>')
}
});
});
</script>
<ul id="latest-announcements">
</ul>
ajax link (11-Jan @ 14:12)
Syntax Highlighted Code
- $(document).ready(function(){
- $('.ajaxtrigger').click(function(){
- $('#target').load($(this).attr('href'));
- return false;
- [1 more lines...]
Plain Code
$(document).ready(function(){
$('.ajaxtrigger').click(function(){
$('#target').load($(this).attr('href'));
return false;
});
});
Untitled JavaScript (10-Jan @ 16:43)
Syntax Highlighted Code
- <!doctype html>
- <html>
- <head>
- <title>jQuery UI Autocomplete Default Demo</title>
- [49 more lines...]
Plain Code
<!doctype html>
<html>
<head>
<title>jQuery UI Autocomplete Default Demo</title>
<link type="text/css" href="../../themes/base/ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="../../jquery-1.3.2.js"></script>
<script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
<script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
<script type="text/javascript" src="../../ui/jquery.ui.position.js"></script>
<script type="text/javascript" src="../../ui/jquery.ui.autocomplete.js"></script>
<link type="text/css" href="../demos.css" rel="stylesheet" />
<script type="text/javascript">
$(function() {
var availableTags = ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby", "python", "c", "scala", "groovy", "haskell", "pearl"];
availableTags = [
{ value: 'private1', label: 'Option 1' },
{ value: 'private2', label: 'Option 2' },
{ value: 'private3', label: 'Option 3' },
{ value: 'private4', label: 'Option 4' },
{ value: 'private5', label: 'Option 5' }
];
$("#tags").autocomplete({
source: availableTags,
focus: function(event, ui) {
$(this).val(ui.item.label);
return false;
}
});
});
</script>
</head>
<body>
<div class="demo">
<div class="ui-widget">
<label for="tags">Tags: </label>
<input class="ui-widget ui-widget-content ui-corner-all" id="tags" />
</div>
</div><!-- End demo -->
<div class="demo-description">
<p>
The Autocomplete widgets provides suggestions while you type into the field. Here the suggestions are tags for programming languages, give "ja" (for Java or JavaScript) a try.
</p>
<p>
The datasource is a simple JavaScript array, provided to the widget using the source-option.
</p>
</div><!-- End demo-description -->
</body>
</html>
dropDown (3-Jan @ 20:49)
Syntax Highlighted Code
- //Site Switcher
- $(document).ready(function() {
- $(".swither_header").click(function () {
- if ($("#links").is(":hidden")) {
- [11 more lines...]
Plain Code
//Site Switcher
$(document).ready(function() {
$(".swither_header").click(function () {
if ($("#links").is(":hidden")) {
$("#links").slideDown();
} else {
$("#links").slideUp();
}
});
$(".switcher_wrap").hover(
function () {},
function () {
$("#links").slideUp();
}
);
});
dropDown (3-Jan @ 20:47)
Syntax Highlighted Code
- $(document).ready(function() {
- $(".swither_header").click(function () {
- if ($("#links").is(":hidden")) {
- [11 more lines...]
Plain Code
$(document).ready(function() {
$(".swither_header").click(function () {
if ($("#links").is(":hidden")) {
$("#links").slideDown();
} else {
$("#links").slideUp();
}
});
$(".switcher_wrap").hover(
function () {},
function () {
$("#links").slideUp();
}
);
});
pager (13-Dec @ 16:20)
Syntax Highlighted Code
- /*
- * Pager - jQuery plugin to format serch result pagers
- */
- [101 more lines...]
Plain Code
/*
* Pager - jQuery plugin to format serch result pagers
*/
;(function($) {
function assertHasClass(element, c, errormsg) {
if(!$(element).hasClass(c)) {throw errormsg;}
}
$.extend($.fn, {
showPager: function(callback, size) {
var PAGER_SIZE = parseInt(size) || 14;
$(this).each(function() {
assertHasClass(this, 'pager', "element must be a pager");
var pages = jQuery('.page:not(.nextPage, .previousPage)', this);
if(pages.length <= PAGER_SIZE) {
pages.show();
} else {
var current = pages.index(pages.filter('.currentPage'));
if(current<=PAGER_SIZE-4) {
pages.each(function(i) {
var page = jQuery(this);
if(i === PAGER_SIZE - 2){
page.replaceWith('<span>...</span>');
}else if(i<PAGER_SIZE - 1) {
page.show();
} else if(i === pages.length - 1) {
page.show();
}
});
} else if(current > pages.length-(PAGER_SIZE-2)) {
pages.each(function(i) {
var page = jQuery(this);
if(i === 0){
page.show();
}else if(i === 1){
page.replaceWith('<span>...</span>');
}else if(i > pages.length - (PAGER_SIZE-1)) {
page.show();
}
});
} else {
pages.each(function(i) {
var page = jQuery(this);
if(i === 0){
page.show();
}else if(i === 1){
page.replaceWith('<span>...</span>');
}else if(i === pages.length -1) {
page.show();
}else if(i === pages.length - 2){
page.replaceWith('<span>...</span>');
}else if(i > (current - Math.floor(PAGER_SIZE/2)+2) && (i < (current + Math.floor(PAGER_SIZE/2) - 1))) {
page.show();
}
});
}
}
if(typeof callback == 'function') {
jQuery('a.page', this).click(function() {
callback(this.href.slice(this.href.lastIndexOf('#')+1, this.href.length));
});
}
return this;
});
}
});
})(jQuery);
<%@ attribute name="current" required="true" rtexprvalue="true" type="java.lang.Integer" %>
<%@ attribute name="pages" required="true" rtexprvalue="true" type="java.util.Collection" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<span class="pager">
<c:choose>
<c:when test="${current > 1}"><a class="page previousPage" href="#${current - 1}"><fmt:message key="general.previous"/></a></c:when>
<c:otherwise><span class="page previousPage"><fmt:message key="general.previous"/></span></c:otherwise>
</c:choose>
<c:forEach var="page" items="${pages}">
<c:choose>
<c:when test="${page == current}">
<span class="page currentPage" style="display: none">${page}</span>
</c:when>
<c:when test="${page == -1}">
<span class="page break">...</span>
</c:when>
<c:otherwise>
<a class="page" href="#${page}" style="display: none">${page}</a>
</c:otherwise>
</c:choose>
</c:forEach>
<c:choose>
<c:when test="${current < fn:length(pages)}"><a class="page nextPage" href="#${current + 1}"><fmt:message key="general.next"/></a></c:when>
<c:otherwise><span class="page nextPage"><fmt:message key="general.next"/></span></c:otherwise>
</c:choose>
</span>
Ajax delete (8-Dec @ 17:47)
Syntax Highlighted Code
- $(".delete-action a").live("click", function() {
- var linkElement = $(this);
- var parentCell = $(linkElement).parent();
- var parentRow = $(linkElement).parent().parent();
- [15 more lines...]
Plain Code
$(".delete-action a").live("click", function() {
var linkElement = $(this);
var parentCell = $(linkElement).parent();
var parentRow = $(linkElement).parent().parent();
$("#dialog").dialog("open");
parentCell.html(xhrActivity + "Deleting...");
$.get(this.href, function(data){
// alert(data);
parentRow.fadeTo(100, 1).fadeOut('slow', function() {
$(this).remove();
rowStripes();
rowCount();
});
});
return false;
});
jQuery.rgbToHex (25-Nov @ 11:32)
Syntax Highlighted Code
- /**
- * jQuery.rgbToHex - Converts an RGB string to a HEX string (forces length 6)
- * @author Joshua Baker
- * @version 1.0.0
- [41 more lines...]
Plain Code
/**
* jQuery.rgbToHex - Converts an RGB string to a HEX string (forces length 6)
* @author Joshua Baker
* @version 1.0.0
*/
;(function($){
$.extend({
rgbToHex: function(rgbString) {
var parts = rgbString.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
if (!parts)
{
if (rgbString.length < 6) {
var parts = rgbString.split('');
delete (parts[0]);
for (var i = 1; i <= 3; ++i)
{
parts[i] = parts[i] + parts[i];
}
return '#' + parts.join('');
}
else
{
return rgbString;
}
}
else
{
delete (parts[0]);
for (var i = 1; i <= 3; ++i)
{
parts[i] = parseInt(parts[i]).toString(16);
if (parts[i].length == 1) parts[i] = parts[i] + parts[i];
}
return '#' + parts.join('');
}
}
});
})(jQuery);
/**
* jQuery.rgbToHex - Converts an RGB string to a HEX string (forces length 6)
* @author Joshua Baker
* @version 1.0.0
*/
;(function(a){a.extend({rgbToHex:function(d){var c=d.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);if(!c){if(d.length<6){var c=d.split("");delete (c[0]);for(var b=1;b<=3;++b){c[b]=c[b]+c[b]}return"#"+c.join("")}else{return d}}else{delete (c[0]);for(var b=1;b<=3;++b){c[b]=parseInt(c[b]).toString(16);if(c[b].length==1){c[b]=c[b]+c[b]}}return"#"+c.join("")}}})})(jQuery);
scrollIntoView method JavaScript (13-Nov @ 11:57)
Syntax Highlighted Code
- var targetOffset = jQuery(target).offset().top;
- var containerOffset = jQuery('#productsDiv').offset().top;
- if(targetOffset < containerOffset) {
- target.scrollIntoView();
- }
Plain Code
var targetOffset = jQuery(target).offset().top;
var containerOffset = jQuery('#productsDiv').offset().top;
if(targetOffset < containerOffset) {
target.scrollIntoView();
}
javascript pointcut example (11-Nov @ 10:56)
Syntax Highlighted Code
- /* This will intercept the jQuery bind event
- * and logs the number of calls
- */
- jQuery.fn.bind = function (bind) {
- [5 more lines...]
Plain Code
/* This will intercept the jQuery bind event
* and logs the number of calls
*/
jQuery.fn.bind = function (bind) {
return function () {
console.count("jQuery bind count");
console.log("jQuery bind %o", this);
return bind.apply(this, arguments);
};
}(jQuery.fn.bind);
explorer style jquery treeview (23-Oct @ 14:32)
Syntax Highlighted Code
- /*
- * Treeview 1.4 - jQuery plugin to hide and show branches of a tree
- *
- * http://bassistance.de/jquery-plugins/jquery-plugin-treeview/
- [275 more lines...]
Plain Code
/*
* Treeview 1.4 - jQuery plugin to hide and show branches of a tree
*
* http://bassistance.de/jquery-plugins/jquery-plugin-treeview/
* http://docs.jquery.com/Plugins/Treeview
*
* Copyright (c) 2007 Jörn Zaefferer
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* Revision: $Id: jquery.treeview.js 4684 2008-02-07 19:08:06Z joern.zaefferer $
*
* Additions by Andreas Bjärlestam:
* - Added stayopen option
* - Added expandAll jQuery object method
* - Added removeFolders jQuery object method
*/
;(function($) {
$.extend($.fn, {
swapClass: function(c1, c2) {
var c1Elements = this.filter('.' + c1);
this.filter('.' + c2).removeClass(c2).addClass(c1);
c1Elements.removeClass(c1).addClass(c2);
return this;
},
replaceClass: function(c1, c2) {
return this.filter('.' + c1).removeClass(c1).addClass(c2).end();
},
hoverClass: function(className) {
className = className || "hover";
return this.hover(function() {
$(this).addClass(className);
}, function() {
$(this).removeClass(className);
});
},
heightToggle: function(animated, callback) {
animated ?
this.animate({ height: "toggle" }, animated, callback) :
this.each(function(){
jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ]();
if(callback)
callback.apply(this, arguments);
});
},
heightHide: function(animated, callback) {
if (animated) {
this.animate({ height: "hide" }, animated, callback);
} else {
this.hide();
if (callback)
this.each(callback);
}
},
prepareBranches: function(settings) {
if (!settings.prerendered) {
// mark last tree items
this.filter(":last-child:not(ul)").addClass(CLASSES.last);
// collapse whole tree, or only those marked as closed, anyway except those marked as open
this.filter((settings.collapsed ? "" : "." + CLASSES.closed) + ":not(." + CLASSES.open + ")").find(">ul").hide();
}
// return all items with sublists
return this.filter(":has(>ul)");
},
applyClasses: function(settings, toggler) {
this.filter(":has(>ul):not(:has(>a))").find(">span").click(function(event) {
toggler.apply($(this).next());
}).add( $("a", this) ).hoverClass();
if (!settings.prerendered) {
// handle closed ones first
this.filter(":has(>ul:hidden)")
.addClass(CLASSES.expandable)
.replaceClass(CLASSES.last, CLASSES.lastExpandable);
// handle open ones
this.not(":has(>ul:hidden)")
.addClass(CLASSES.collapsable)
.replaceClass(CLASSES.last, CLASSES.lastCollapsable);
// create hitarea
this.prepend("<div class=\"" + CLASSES.hitarea + "\"/>").find("div." + CLASSES.hitarea).each(function() {
var classes = "";
$.each($(this).parent().attr("class").split(" "), function() {
classes += this + "-hitarea ";
});
$(this).addClass( classes );
});
}
// apply event to hitarea
this.find("div." + CLASSES.hitarea).click( toggler );
},
expandAll: function() {
if(!this.hasClass("treeview")) {throw "can't expand element that is not a tree"};
$("div." + CLASSES.hitarea, this)
.replaceClass( CLASSES.expandableHitarea, CLASSES.collapsableHitarea )
.replaceClass( CLASSES.lastExpandableHitarea, CLASSES.lastCollapsableHitarea )
.parent()
.replaceClass( CLASSES.expandable, CLASSES.collapsable )
.replaceClass( CLASSES.lastExpandable, CLASSES.lastCollapsable )
.find( ">ul" ).show();
return this;
},
removeFolders: function(folderIds) {
if(!this.hasClass("treeview")) {throw "can't remove folders from element that is not a tree"};
var tree = this;
jQuery.each(folderIds, function() {
tree.find('input.folderId[value='+ this +']').parents('li:first').remove();
});
return this;
},
treeview: function(settings) {
settings = $.extend({
cookieId: "treeview"
}, settings);
if (settings.add) {
return this.trigger("add", [settings.add]);
}
if ( settings.toggle ) {
var callback = settings.toggle;
settings.toggle = function() {
return callback.apply($(this).parent()[0], arguments);
};
}
// factory for treecontroller
function treeController(tree, control) {
// factory for click handlers
function handler(filter) {
return function() {
// reuse toggle event handler, applying the elements to toggle
// start searching for all hitareas
toggler.apply( $("div." + CLASSES.hitarea, tree).filter(function() {
// for plain toggle, no filter is provided, otherwise we need to check the parent element
return filter ? $(this).parent("." + filter).length : true;
}) );
return false;
};
}
// click on first element to collapse tree
$("a:eq(0)", control).click( handler(CLASSES.collapsable) );
// click on second to expand tree
$("a:eq(1)", control).click( handler(CLASSES.expandable) );
// click on third to toggle tree
$("a:eq(2)", control).click( handler() );
}
// handle toggle event
function toggler() {
if( settings.stayopen
&& $(this).is(':not(div.hitarea)')
&& $(this).parent().find(">.hitarea").hasClass(CLASSES.collapsableHitarea)) {
return;
}
$(this)
.parent()
// swap classes for hitarea
.find(">.hitarea")
.swapClass( CLASSES.collapsableHitarea, CLASSES.expandableHitarea )
.swapClass( CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea )
.end()
// swap classes for parent li
.swapClass( CLASSES.collapsable, CLASSES.expandable )
.swapClass( CLASSES.lastCollapsable, CLASSES.lastExpandable )
// find child lists
.find( ">ul" )
// toggle them
.heightToggle( settings.animated, settings.toggle );
if ( settings.unique ) {
$(this).parent()
.siblings()
// swap classes for hitarea
.find(">.hitarea")
.replaceClass( CLASSES.collapsableHitarea, CLASSES.expandableHitarea )
.replaceClass( CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea )
.end()
.replaceClass( CLASSES.collapsable, CLASSES.expandable )
.replaceClass( CLASSES.lastCollapsable, CLASSES.lastExpandable )
.find( ">ul" )
.heightHide( settings.animated, settings.toggle );
}
}
function serialize() {
function binary(arg) {
return arg ? 1 : 0;
}
var data = [];
branches.each(function(i, e) {
data[i] = $(e).is(":has(>ul:visible)") ? 1 : 0;
});
$.cookie(settings.cookieId, data.join("") );
}
function deserialize() {
var stored = $.cookie(settings.cookieId);
if ( stored ) {
var data = stored.split("");
branches.each(function(i, e) {
$(e).find(">ul")[ parseInt(data[i]) ? "show" : "hide" ]();
});
}
}
// add treeview class to activate styles
this.addClass("treeview");
// prepare branches and find all tree items with child lists
var branches = this.find("li").prepareBranches(settings);
switch(settings.persist) {
case "cookie":
var toggleCallback = settings.toggle;
settings.toggle = function() {
serialize();
if (toggleCallback) {
toggleCallback.apply(this, arguments);
}
};
deserialize();
break;
case "location":
var current = this.find("a").filter(function() { return this.href.toLowerCase() == location.href.toLowerCase(); });
if ( current.length ) {
current.addClass("selected").parents("ul, li").add( current.next() ).show();
}
break;
}
branches.applyClasses(settings, toggler);
// if control option is set, create the treecontroller and show it
if ( settings.control ) {
treeController(this, settings.control);
$(settings.control).show();
}
return this.bind("add", function(event, branches) {
$(branches).prev()
.removeClass(CLASSES.last)
.removeClass(CLASSES.lastCollapsable)
.removeClass(CLASSES.lastExpandable)
.find(">.hitarea")
.removeClass(CLASSES.lastCollapsableHitarea)
.removeClass(CLASSES.lastExpandableHitarea);
$(branches).find("li").andSelf().prepareBranches(settings).applyClasses(settings, toggler);
});
}
});
// classes used by the plugin
// need to be styled via external stylesheet, see first example
var CLASSES = $.fn.treeview.classes = {
open: "open",
closed: "closed",
expandable: "expandable",
expandableHitarea: "expandable-hitarea",
lastExpandableHitarea: "lastExpandable-hitarea",
collapsable: "collapsable",
collapsableHitarea: "collapsable-hitarea",
lastCollapsableHitarea: "lastCollapsable-hitarea",
lastCollapsable: "lastCollapsable",
lastExpandable: "lastExpandable",
last: "last",
hitarea: "hitarea"
};
// provide backwards compability
$.fn.Treeview = $.fn.treeview;
})(jQuery);
Untitled JavaScript (16-Oct @ 04:58)
Syntax Highlighted Code
- function search(text, callback) {
- script.src = 'http://api.flickr.com/services/?.....&jsoncallback=' + callback;
- document.body.appendChild(script);
- }
- [15 more lines...]
Plain Code
function search(text, callback) {
script.src = 'http://api.flickr.com/services/?.....&jsoncallback=' + callback;
document.body.appendChild(script);
}
/* #1 */
var cb;
cb[0] = function(){ /* put result in #div0 */ };
cb[1] = function(){ /* put result in #div1 */ };
cb[...] = function() {...};
search('hello', 'cb[0]');
search('hello2', 'cb[1]');
/* #2 */
var cb;
eval('cb1 = function() { /* put result in #div0 */ }');
eval('cb2 = function() { /* put result in #div0 */ }');
....
search('hello', 'cb0');
search('hello2', 'cb1');
Untitled JavaScript (16-Oct @ 04:56)
Syntax Highlighted Code
- function search(text, callback) {
- script.src = 'http://api.flickr.com/services/?.....&jsoncallback=' + callback;
- document.body.appendChild(script);
- }
- [13 more lines...]
Plain Code
function search(text, callback) {
script.src = 'http://api.flickr.com/services/?.....&jsoncallback=' + callback;
document.body.appendChild(script);
}
/* #1 */
var cb;
cb[0] = function(){ /* put result in #div0 */ };
cb[1] = function(){ /* put result in #div1 */ };
cb[...] = function() {...};
/* #2 */
var cb;
eval('cb1 = function() { /* put result in #div0 */ }');
eval('cb2 = function() { /* put result in #div0 */ }');
....
/* main */
search('hello', 'cb[0]');
search('hello2', 'cb[1]');
JavaScript event delegator template for jQuery (2-Oct @ 13:48)
Syntax Highlighted Code
- jQuery(document).ready(function() {
- jQuery("body").click(function(e) {
- var target = jQuery(e.target);
- [3 more lines...]
Plain Code
jQuery(document).ready(function() {
jQuery("body").click(function(e) {
var target = jQuery(e.target);
if (target.hasClass('someclass')) return doSomeStuff();
if (target.hasClass('someotherclass')) return doOtherStuff();
});
});
Untitled JavaScript (29-Sep @ 14:01)
Syntax Highlighted Code
- /* jQuery Fundamentals Training: iContact */
Plain Code
/* jQuery Fundamentals Training: iContact */
Untitled JavaScript (29-Sep @ 13:57)
Syntax Highlighted Code
- /* jQuery Fundamentals Training: iContact */
Plain Code
/* jQuery Fundamentals Training: iContact */
insert record (21-Sep @ 18:51)
Syntax Highlighted Code
- jQuery.fn.InsertRecord = function () {
- $(this).keyup(function(e){
- if(e.keyCode==13){
- var value = $(this).val();
- [17 more lines...]
Plain Code
jQuery.fn.InsertRecord = function () {
$(this).keyup(function(e){
if(e.keyCode==13){
var value = $(this).val();
var id = $(this).attr("name");
var thiscase = $(this).attr('rel');
var xtra = arguments[0];
$.ajax({
type: "POST",
url: "/includes/power/actions.php",
data: "x=i&x2="+thiscase+"&value="+value+"&id="+id+xtra,
success: function(msg){
// window.location.reload();
}
});
}
});
};
Untitled JavaScript (7-Sep @ 16:36)
Syntax Highlighted Code
- function anders(){
- }
Plain Code
function anders(){
}
Untitled JavaScript (7-Sep @ 15:29)
Syntax Highlighted Code
- function getSetCarouselControlsInfo () {
- var carouselConf = carousel.scrollable();
- var current = carouselConf.getPageIndex() + 1;
- [320 more lines...]
Plain Code
function getSetCarouselControlsInfo () {
var carouselConf = carousel.scrollable();
var current = carouselConf.getPageIndex() + 1;
var total = carouselConf.getSize();
var currentSpan = $('#feature p span#current');
var totalSpan = $('#feature p span#total');
$('p.left').hide();
currentSpan.text(current);
totalSpan.text(total);
if (currentSpan.text() == "1") {
$('p.left').fadeOut('slow');
}
else $('p.left').fadeIn('slow');
if (currentSpan.text() == total) {
$('p.right').hide('slow');
}
else $('p.right').show('slow');
}
function initCarouselHome (scrollableDiv){
carousel = $(scrollableDiv);
$(carousel).scrollable({
size: 1,
next: 'p.right',
prev: 'p.left',
easing: 'swing',
onSeek: function() {
getSetCarouselControlsInfo();
}
});
}
function initCarouselSmall (){
$(".news-feature .scrollable").scrollable({
vertical:true,
next: 'p.bottom',
prev: 'p.top',
size: 3
});
}
function carouselClickable (){
$('ul.items li').click(function(){
var href = $(this).find('a').attr('href');
window.location.href = href;
});
}
function linkExpanderAndHover(listItemString) {
listItem = $(listItemString);
listItem.mouseover(function(){
$(this).css({
'cursor' : 'pointer'
});
$(this).find('a').css({
'text-decoration' : 'underline'
});
$(this).addClass('hovered');
});
listItem.mouseout(function(){
$(this).find('a').css({
'text-decoration' : 'none'
});
$(this).removeClass('hovered');
});
listItem.click(function(){
var href = $(this).find('a').attr('href');
window.location.href = href;
});
}
function searchChanger (){
$('#search-changer ul li').click(function(){
$('#search-changer li.selected').removeClass('selected');
$(this).addClass('selected');
});
}
function mouseOvers (){
$('button.submit').hover(
function () { $(this).css({ 'background' : 'url(assets/images/go-hover.gif) no-repeat' }); },
function () { $(this).css({ 'background' : 'url(assets/images/go.gif) no-repeat' });
});
$('.news-feature .items li').hover(
function () { $(this).css({ 'background' : 'url(assets/images/thumb-bg1-hover.png) no-repeat' }); },
function () { $(this).css({ 'background' : 'url(assets/images/thumb-bg1.png) no-repeat' });
});
$('#search-changer #search-submit, #content-search-button').hover(
function () { $(this).css({ 'background' : 'url(assets/images/search-hover.gif) no-repeat' }); },
function () { $(this).css({ 'background' : 'url(assets/images/search.gif) no-repeat' });
});
$('.news-feature p.top').hover(
function () { $(this).css({ 'background' : 'url(assets/images/carousel-up-blue.gif) no-repeat' }); },
function () { $(this).css({ 'background' : 'url(assets/images/carousel-up.gif) no-repeat' });
});
$('.news-feature p.bottom').hover(
function () { $(this).css({ 'background' : 'url(assets/images/carousel-down-blue.gif) no-repeat' }); },
function () { $(this).css({ 'background' : 'url(assets/images/carousel-down.gif) no-repeat' });
});
}
function initSifr(){
$('.col h2').sifr({
path: 'assets/fonts/',
font: 'bliss-pro-bold',
fontSize: "24px"
});
$('.bar h3 a').sifr({
path: 'assets/fonts/',
font: 'bliss-pro-bold',
fontSize: "44em"
});
}
function setSearchKeywordField(){
$('#search input#search-box').attr({ value: 'Search the site...' }).focus(function(){
if ($(this).val()=='Search the site...') {
$(this).val("");
}
}).blur(function(){
if ($(this).val()=="") {
$(this).val('Search the site...');
}
});
}
function gridList (){
var gridListItem = $('.grid ul li');
//remove current css
gridListItem.css('float', 'none');
gridListItem.find('a:hover').css('text-decoration', 'none');
//add Classes for columns
gridListItem.slice(0, 9).addClass('col1');
gridListItem.slice(9, 18).addClass('col2');
gridListItem.slice(18, 27).addClass('col3');
$('.grid ul li:eq(9)').addClass('reset1');
$('.grid ul li:eq(18)').addClass('reset2');
//clickable
gridListItem.click(function(){
var href = $(this).find('a').attr('href');
window.location.href = href;
});
//mouse css
gridListItem.css('cursor', 'pointer');
gridListItem.mouseover(function(){
$(this).css({
'background-image' : 'url(/assets/images/grid-li-bg-hover.gif)',
'background-position' : '0px -1px'
});
});
gridListItem.mouseout(function(){
$(this).css({
'background-image' : 'url(/assets/images/grid-li-bg.gif)',
'background-position' : '0px 0px'
});
});
}
function dropDownList(nestedLists){
var liParent = nestedLists.find('ul').parent('li');
var liParent2 = nestedLists.find('ul ul').parent('li');
liParent.find('ul:first').hide();
liParent.find('a:first').each(function(){
$(this).hover(
function () { $(this).addClass('hovered'); },
function () { $(this).removeClass('hovered');
});
$(this).click(function(){
$(this).toggleClass('selected');
$(this).parents('li:first').find('ul:first').slideToggle('slow');
});
});
liParent2.find('a:first').each(function(){
$(this).click(function(){
$(this).toggleClass('selected');
$(this).parents('li:first').find('ul:first').hide();
});
});
}
function rollOverShowInfo(){
$('.large-grid .info p').hide();
$('.large-grid ul li').each(function(){
$(this).mouseover(function(){
$(this).find('.info p').show();
});
$(this).mouseout(function(){
$(this).find('.info p').hide();
});
});
}
function initTooltip(tooltipString){
tooltipTrigger = $(tooltipString);
tooltipTrigger.tooltip({
bodyHandler: function() {
return $($(this).attr("href")).html();
},
fixPNG: true,
fade: 250,
top: -145,
left: 10,
showURL: false
});
}
$(function callOnPageID (){
var page = $('body').attr('id');
switch (page) {
case 'home':
initCarouselHome('div.scrollable');
getSetCarouselControlsInfo();
initSifr();
carouselClickable();
searchChanger();
mouseOvers();
setSearchKeywordField();
linkExpanderAndHover('.col ul li');
break;
case 'video-grid':
var contentClass = $('#content').attr('class');
if (contentClass == 'large-grid') {
setSearchKeywordField();
rollOverShowInfo();
linkExpanderAndHover('.large-grid ul li');
}
else {
gridList();
}
mouseOvers();
break;
case 'news':
linkExpanderAndHover('ul.vertical-text-img li');
linkExpanderAndHover('.titled-lists ul li');
var nestedLists = $('ul.drop-down');
dropDownList(nestedLists);
break;
case 'news':
linkExpanderAndHover('ul.vertical-text-img li');
linkExpanderAndHover('.titled-lists ul li');
var nestedLists = $('ul.drop-down');
dropDownList(nestedLists);
break;
case 'a-z':
linkExpanderAndHover('ul.wide li');
break;
case 'publications':
linkExpanderAndHover('ul.publications li');
break;
case 'project-detail':
linkExpanderAndHover('ul.vertical-text-img li');
linkExpanderAndHover('.titled-lists ul li');
linkExpanderAndHover('.white-cell ul li');
linkExpanderAndHover('.grey-cell ul li');
var nestedLists = $('ul.drop-down');
dropDownList(nestedLists);
initCarouselSmall();
break;
case 'template':
linkExpanderAndHover('ul.vertical-text-img li');
linkExpanderAndHover('.titled-lists ul li');
linkExpanderAndHover('.white-cell ul li');
linkExpanderAndHover('.grey-cell ul li');
var nestedLists = $('ul.drop-down');
dropDownList(nestedLists);
initCarouselSmall();
initTooltip('a.pdf');
mouseOvers();
setSearchKeywordField();
break;
default:
break;
}
});
double form submit prevention (31-Aug @ 09:48)
Syntax Highlighted Code
- jQuery.fn.preventDoubleSubmit = function() {
- jQuery(this).submit(function() {
- if (this.beenSubmitted)
- return false;
- [6 more lines...]
Plain Code
jQuery.fn.preventDoubleSubmit = function() {
jQuery(this).submit(function() {
if (this.beenSubmitted)
return false;
else
this.beenSubmitted = true;
});
};
// jQuery('#my_form').preventDoubleSubmit();
Getting rid of border-bottom (31-Aug @ 09:42)
Syntax Highlighted Code
- $(function() { $('a:has(img)').addClass('image'); });
Plain Code
$(function() { $('a:has(img)').addClass('image'); });
Untitled JavaScript (25-Aug @ 12:07)
Syntax Highlighted Code
- $(window).load(function() {
- // run this when the whole page has been downloaded
- });
Plain Code
$(window).load(function() {
// run this when the whole page has been downloaded
});
Load Only What You Really Need on DOM ready (22-Aug @ 09:47)
Syntax Highlighted Code
- // Load Only What You Really Need
- $(document).ready (function () {
- if ('body').hasClass ('home') {
- // home page code
- [6 more lines...]
Plain Code
// Load Only What You Really Need
$(document).ready (function () {
if ('body').hasClass ('home') {
// home page code
}
else if ('body').hasClass ('blog') {
// blog code
}
// and so on
});
Fix IE6 background image flicker (22-Aug @ 09:09)
Syntax Highlighted Code
- <!--[if lte IE 6]>
- <script type="text/javascript">
- //Fix IE6 background image flicker
- function fixIE6flicker(fix) {
- [6 more lines...]
Plain Code
<!--[if lte IE 6]>
<script type="text/javascript">
//Fix IE6 background image flicker
function fixIE6flicker(fix) {
try {
document.execCommand("BackgroundImageCache", false, fix);
} catch(err) { }
}
window.onload = function() { fixIE6flicker(true); }
</script>
<![endif]-->
Ajax Pagination (22-Aug @ 09:04)
Syntax Highlighted Code
- //Ajax pagination.js
- $(function() {
- $(".pagination a").live("click", function() {
- $(".pagination").html("Page is loading...");
- [4 more lines...]
Plain Code
//Ajax pagination.js
$(function() {
$(".pagination a").live("click", function() {
$(".pagination").html("Page is loading...");
$.get(this.href, null, null, "script");
return false;
});
});
Untitled JavaScript (31-Jul @ 07:39)
Syntax Highlighted Code
- $(document).ready(function(){
- $('em.ctdelete').click(function () {
- alert($(this).attr('id'));
- [13 more lines...]
Plain Code
$(document).ready(function(){
$('em.ctdelete').click(function () {
alert($(this).attr('id'));
});
//var tbl = prettyPrint( Drupal );
//document.body.insertBefore( tbl, document.body.firstChild );
});
Untitled JavaScript (24-Jul @ 02:49)
Syntax Highlighted Code
- $.fn.zIndex = function(zIndex) {
- if (zIndex !== undefined) {
- return this.css('zIndex', zIndex);
- }
- [8 more lines...]
Plain Code
$.fn.zIndex = function(zIndex) {
if (zIndex !== undefined) {
return this.css('zIndex', zIndex);
}
var elem = this[0];
while (elem) {
if (elem.style.zIndex)
return elem.style.zIndex;
elem = elem.parentNode;
}
return 0;
};
Untitled JavaScript (24-Jul @ 02:44)
Syntax Highlighted Code
- $.fn.zIndex = function(zIndex) {
- if (zIndex !== undefined) {
- return this.css('zIndex', zIndex);
- }
- [6 more lines...]
Plain Code
$.fn.zIndex = function(zIndex) {
if (zIndex !== undefined) {
return this.css('zIndex', zIndex);
}
var elem = this[0];
while (elem && elem.style.zIndex === '' && elem.parentNode) {
elem = elem.parentNode;
}
return elem.style.zIndex || 0;
};
Untitled JavaScript (17-Jul @ 14:29)
Syntax Highlighted Code
- /*!
- * jQuery JavaScript Library v1.3.2
- * http://jquery.com/
- *
- [1894 more lines...]
Plain Code
/*!
* jQuery JavaScript Library v1.3.2
* http://jquery.com/
*
* Copyright (c) 2009 John Resig
* Dual licensed under the MIT and GPL licenses.
* http://docs.jquery.com/License
*
* Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
* Revision: 6246
*/
(function(){
var
// Will speed up references to window, and allows munging its name.
window = this,
// Will speed up references to undefined, and allows munging its name.
undefined,
// Map over jQuery in case of overwrite
_jQuery = window.jQuery,
// Map over the $ in case of overwrite
_$ = window.$,
jQuery = window.jQuery = window.$ = function( selector, context ) {
// The jQuery object is actually just the init constructor 'enhanced'
return new jQuery.fn.init( selector, context );
},
// A simple way to check for HTML strings or ID strings
// (both of which we optimize for)
quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,
// Is it a simple selector
isSimple = /^.[^:#\[\.,]*$/;
jQuery.fn = jQuery.prototype = {
init: function( selector, context ) {
// Make sure that a selection was provided
selector = selector || document;
// Handle $(DOMElement)
if ( selector.nodeType ) {
this[0] = selector;
this.length = 1;
this.context = selector;
return this;
}
// Handle HTML strings
if ( typeof selector === "string" ) {
// Are we dealing with HTML string or an ID?
var match = quickExpr.exec( selector );
// Verify a match, and that no context was specified for #id
if ( match && (match[1] || !context) ) {
// HANDLE: $(html) -> $(array)
if ( match[1] )
selector = jQuery.clean( [ match[1] ], context );
// HANDLE: $("#id")
else {
var elem = document.getElementById( match[3] );
// Handle the case where IE and Opera return items
// by name instead of ID
if ( elem && elem.id != match[3] )
return jQuery().find( selector );
// Otherwise, we inject the element directly into the jQuery object
var ret = jQuery( elem || [] );
ret.context = document;
ret.selector = selector;
return ret;
}
// HANDLE: $(expr, [context])
// (which is just equivalent to: $(content).find(expr)
} else
return jQuery( context ).find( selector );
// HANDLE: $(function)
// Shortcut for document ready
} else if ( jQuery.isFunction( selector ) )
return jQuery( document ).ready( selector );
// Make sure that old selector state is passed along
if ( selector.selector && selector.context ) {
this.selector = selector.selector;
this.context = selector.context;
}
return this.setArray(jQuery.isArray( selector ) ?
selector :
jQuery.makeArray(selector));
},
// Start with an empty selector
selector: "",
// The current version of jQuery being used
jquery: "1.3.2",
// The number of elements contained in the matched element set
size: function() {
return this.length;
},
// Get the Nth element in the matched element set OR
// Get the whole matched element set as a clean array
get: function( num ) {
return num === undefined ?
// Return a 'clean' array
Array.prototype.slice.call( this ) :
// Return just the object
this[ num ];
},
// Take an array of elements and push it onto the stack
// (returning the new matched element set)
pushStack: function( elems, name, selector ) {
// Build a new jQuery matched element set
var ret = jQuery( elems );
// Add the old object onto the stack (as a reference)
ret.prevObject = this;
ret.context = this.context;
if ( name === "find" )
ret.selector = this.selector + (this.selector ? " " : "") + selector;
else if ( name )
ret.selector = this.selector + "." + name + "(" + selector + ")";
// Return the newly-formed element set
return ret;
},
// Force the current matched set of elements to become
// the specified array of elements (destroying the stack in the process)
// You should use pushStack() in order to do this, but maintain the stack
setArray: function( elems ) {
// Resetting the length to 0, then using the native Array push
// is a super-fast way to populate an object with array-like properties
this.length = 0;
Array.prototype.push.apply( this, elems );
return this;
},
// Execute a callback for every element in the matched set.
// (You can seed the arguments with an array of args, but this is
// only used internally.)
each: function( callback, args ) {
return jQuery.each( this, callback, args );
},
// Determine the position of an element within
// the matched set of elements
index: function( elem ) {
// Locate the position of the desired element
return jQuery.inArray(
// If it receives a jQuery object, the first element is used
elem && elem.jquery ? elem[0] : elem
, this );
},
attr: function( name, value, type ) {
var options = name;
// Look for the case where we're accessing a style value
if ( typeof name === "string" )
if ( value === undefined )
return this[0] && jQuery[ type || "attr" ]( this[0], name );
else {
options = {};
options[ name ] = value;
}
// Check to see if we're setting style values
return this.each(function(i){
// Set all the styles
for ( name in options )
jQuery.attr(
type ?
this.style :
this,
name, jQuery.prop( this, options[ name ], type, i, name )
);
});
},
css: function( key, value ) {
// ignore negative width and height values
if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 )
value = undefined;
return this.attr( key, value, "curCSS" );
},
text: function( text ) {
if ( typeof text !== "object" && text != null )
return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
var ret = "";
jQuery.each( text || this, function(){
jQuery.each( this.childNodes, function(){
if ( this.nodeType != 8 )
ret += this.nodeType != 1 ?
this.nodeValue :
jQuery.fn.text( [ this ] );
});
});
return ret;
},
wrapAll: function( html ) {
if ( this[0] ) {
// The elements to wrap the target around
var wrap = jQuery( html, this[0].ownerDocument ).clone();
if ( this[0].parentNode )
wrap.insertBefore( this[0] );
wrap.map(function(){
var elem = this;
while ( elem.firstChild )
elem = elem.firstChild;
return elem;
}).append(this);
}
return this;
},
wrapInner: function( html ) {
return this.each(function(){
jQuery( this ).contents().wrapAll( html );
});
},
wrap: function( html ) {
return this.each(function(){
jQuery( this ).wrapAll( html );
});
},
append: function() {
return this.domManip(arguments, true, function(elem){
if (this.nodeType == 1)
this.appendChild( elem );
});
},
prepend: function() {
return this.domManip(arguments, true, function(elem){
if (this.nodeType == 1)
this.insertBefore( elem, this.firstChild );
});
},
before: function() {
return this.domManip(arguments, false, function(elem){
this.parentNode.insertBefore( elem, this );
});
},
after: function() {
return this.domManip(arguments, false, function(elem){
this.parentNode.insertBefore( elem, this.nextSibling );
});
},
end: function() {
return this.prevObject || jQuery( [] );
},
// For internal use only.
// Behaves like an Array's method, not like a jQuery method.
push: [].push,
sort: [].sort,
splice: [].splice,
find: function( selector ) {
if ( this.length === 1 ) {
var ret = this.pushStack( [], "find", selector );
ret.length = 0;
jQuery.find( selector, this[0], ret );
return ret;
} else {
return this.pushStack( jQuery.unique(jQuery.map(this, function(elem){
return jQuery.find( selector, elem );
})), "find", selector );
}
},
clone: function( events ) {
// Do the clone
var ret = this.map(function(){
if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) {
// IE copies events bound via attachEvent when
// using cloneNode. Calling detachEvent on the
// clone will also remove the events from the orignal
// In order to get around this, we use innerHTML.
// Unfortunately, this means some modifications to
// attributes in IE that are actually only stored
// as properties will not be copied (such as the
// the name attribute on an input).
var html = this.outerHTML;
if ( !html ) {
var div = this.ownerDocument.createElement("div");
div.appendChild( this.cloneNode(true) );
html = div.innerHTML;
}
return jQuery.clean([html.replace(/ jQuery\d+="(?:\d+|null)"/g, "").replace(/^\s*/, "")])[0];
} else
return this.cloneNode(true);
});
// Copy the events from the original to the clone
if ( events === true ) {
var orig = this.find("*").andSelf(), i = 0;
ret.find("*").andSelf().each(function(){
if ( this.nodeName !== orig[i].nodeName )
return;
var events = jQuery.data( orig[i], "events" );
for ( var type in events ) {
for ( var handler in events[ type ] ) {
jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data );
}
}
i++;
});
}
// Return the cloned set
return ret;
},
filter: function( selector ) {
return this.pushStack(
jQuery.isFunction( selector ) &&
jQuery.grep(this, function(elem, i){
return selector.call( elem, i );
}) ||
jQuery.multiFilter( selector, jQuery.grep(this, function(elem){
return elem.nodeType === 1;
}) ), "filter", selector );
},
closest: function( selector ) {
var pos = jQuery.expr.match.POS.test( selector ) ? jQuery(selector) : null,
closer = 0;
return this.map(function(){
var cur = this;
while ( cur && cur.ownerDocument ) {
if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selector) ) {
jQuery.data(cur, "closest", closer);
return cur;
}
cur = cur.parentNode;
closer++;
}
});
},
not: function( selector ) {
if ( typeof selector === "string" )
// test special case where just one selector is passed in
if ( isSimple.test( selector ) )
return this.pushStack( jQuery.multiFilter( selector, this, true ), "not", selector );
else
selector = jQuery.multiFilter( selector, this );
var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType;
return this.filter(function() {
return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector;
});
},
add: function( selector ) {
return this.pushStack( jQuery.unique( jQuery.merge(
this.get(),
typeof selector === "string" ?
jQuery( selector ) :
jQuery.makeArray( selector )
)));
},
is: function( selector ) {
return !!selector && jQuery.multiFilter( selector, this ).length > 0;
},
hasClass: function( selector ) {
return !!selector && this.is( "." + selector );
},
val: function( value ) {
if ( value === undefined ) {
var elem = this[0];
if ( elem ) {
if( jQuery.nodeName( elem, 'option' ) )
return (elem.attributes.value || {}).specified ? elem.value : elem.text;
// We need to handle select boxes special
if ( jQuery.nodeName( elem, "select" ) ) {
var index = elem.selectedIndex,
values = [],
options = elem.options,
one = elem.type == "select-one";
// Nothing was selected
if ( index < 0 )
return null;
// Loop through all the selected options
for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
var option = options[ i ];
if ( option.selected ) {
// Get the specifc value for the option
value = jQuery(option).val();
// We don't need an array for one selects
if ( one )
return value;
// Multi-Selects return an array
values.push( value );
}
}
return values;
}
// Everything else, we just grab the value
return (elem.value || "").replace(/\r/g, "");
}
return undefined;
}
if ( typeof value === "number" )
value += '';
return this.each(function(){
if ( this.nodeType != 1 )
return;
if ( jQuery.isArray(value) && /radio|checkbox/.test( this.type ) )
this.checked = (jQuery.inArray(this.value, value) >= 0 ||
jQuery.inArray(this.name, value) >= 0);
else if ( jQuery.nodeName( this, "select" ) ) {
var values = jQuery.makeArray(value);
jQuery( "option", this ).each(function(){
this.selected = (jQuery.inArray( this.value, values ) >= 0 ||
jQuery.inArray( this.text, values ) >= 0);
});
if ( !values.length )
this.selectedIndex = -1;
} else
this.value = value;
});
},
html: function( value ) {
return value === undefined ?
(this[0] ?
this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g, "") :
null) :
this.empty().append( value );
},
replaceWith: function( value ) {
return this.after( value ).remove();
},
eq: function( i ) {
return this.slice( i, +i + 1 );
},
slice: function() {
return this.pushStack( Array.prototype.slice.apply( this, arguments ),
"slice", Array.prototype.slice.call(arguments).join(",") );
},
map: function( callback ) {
return this.pushStack( jQuery.map(this, function(elem, i){
return callback.call( elem, i, elem );
}));
},
andSelf: function() {
return this.add( this.prevObject );
},
domManip: function( args, table, callback ) {
if ( this[0] ) {
var fragment = (this[0].ownerDocument || this[0]).createDocumentFragment(),
scripts = jQuery.clean( args, (this[0].ownerDocument || this[0]), fragment ),
first = fragment.firstChild;
if ( first )
for ( var i = 0, l = this.length; i < l; i++ )
callback.call( root(this[i], first), this.length > 1 || i > 0 ?
fragment.cloneNode(true) : fragment );
if ( scripts )
jQuery.each( scripts, evalScript );
}
return this;
function root( elem, cur ) {
return table && jQuery.nodeName(elem, "table") && jQuery.nodeName(cur, "tr") ?
(elem.getElementsByTagName("tbody")[0] ||
elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
elem;
}
}
};
// Give the init function the jQuery prototype for later instantiation
jQuery.fn.init.prototype = jQuery.fn;
function evalScript( i, elem ) {
if ( elem.src )
jQuery.ajax({
url: elem.src,
async: false,
dataType: "script"
});
else
jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
if ( elem.parentNode )
elem.parentNode.removeChild( elem );
}
function now(){
return +new Date;
}
jQuery.extend = jQuery.fn.extend = function() {
// copy reference to target object
var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options;
// Handle a deep copy situation
if ( typeof target === "boolean" ) {
deep = target;
target = arguments[1] || {};
// skip the boolean and the target
i = 2;
}
// Handle case when target is a string or something (possible in deep copy)
if ( typeof target !== "object" && !jQuery.isFunction(target) )
target = {};
// extend jQuery itself if only one argument is passed
if ( length == i ) {
target = this;
--i;
}
for ( ; i < length; i++ )
// Only deal with non-null/undefined values
if ( (options = arguments[ i ]) != null )
// Extend the base object
for ( var name in options ) {
var src = target[ name ], copy = options[ name ];
// Prevent never-ending loop
if ( target === copy )
continue;
// Recurse if we're merging object values
if ( deep && copy && typeof copy === "object" && !copy.nodeType )
target[ name ] = jQuery.extend( deep,
// Never move original objects, clone them
src || ( copy.length != null ? [ ] : { } )
, copy );
// Don't bring in undefined values
else if ( copy !== undefined )
target[ name ] = copy;
}
// Return the modified object
return target;
};
// exclude the following css properties to add px
var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
// cache defaultView
defaultView = document.defaultView || {},
toString = Object.prototype.toString;
jQuery.extend({
noConflict: function( deep ) {
window.$ = _$;
if ( deep )
window.jQuery = _jQuery;
return jQuery;
},
// See test/unit/core.js for details concerning isFunction.
// Since version 1.3, DOM methods and functions like alert
// aren't supported. They return false on IE (#2968).
isFunction: function( obj ) {
return toString.call(obj) === "[object Function]";
},
isArray: function( obj ) {
return toString.call(obj) === "[object Array]";
},
// check if an element is in a (or is an) XML document
isXMLDoc: function( elem ) {
return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" ||
!!elem.ownerDocument && jQuery.isXMLDoc( elem.ownerDocument );
},
// Evalulates a script in a global context
globalEval: function( data ) {
if ( data && /\S/.test(data) ) {
// Inspired by code by Andrea Giammarchi
// http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
var head = document.getElementsByTagName("head")[0] || document.documentElement,
script = document.createElement("script");
script.type = "text/javascript";
if ( jQuery.support.scriptEval )
script.appendChild( document.createTextNode( data ) );
else
script.text = data;
// Use insertBefore instead of appendChild to circumvent an IE6 bug.
// This arises when a base node is used (#2709).
head.insertBefore( script, head.firstChild );
head.removeChild( script );
}
},
nodeName: function( elem, name ) {
return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
},
// args is for internal usage only
each: function( object, callback, args ) {
var name, i = 0, length = object.length;
if ( args ) {
if ( length === undefined ) {
for ( name in object )
if ( callback.apply( object[ name ], args ) === false )
break;
} else
for ( ; i < length; )
if ( callback.apply( object[ i++ ], args ) === false )
break;
// A special, fast, case for the most common use of each
} else {
if ( length === undefined ) {
for ( name in object )
if ( callback.call( object[ name ], name, object[ name ] ) === false )
break;
} else
for ( var value = object[0];
i < length && callback.call( value, i, value ) !== false; value = object[++i] ){}
}
return object;
},
prop: function( elem, value, type, i, name ) {
// Handle executable functions
if ( jQuery.isFunction( value ) )
value = value.call( elem, i );
// Handle passing in a number to a CSS property
return typeof value === "number" && type == "curCSS" && !exclude.test( name ) ?
value + "px" :
value;
},
className: {
// internal only, use addClass("class")
add: function( elem, classNames ) {
jQuery.each((classNames || "").split(/\s+/), function(i, className){
if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) )
elem.className += (elem.className ? " " : "") + className;
});
},
// internal only, use removeClass("class")
remove: function( elem, classNames ) {
if (elem.nodeType == 1)
elem.className = classNames !== undefined ?
jQuery.grep(elem.className.split(/\s+/), function(className){
return !jQuery.className.has( classNames, className );
}).join(" ") :
"";
},
// internal only, use hasClass("class")
has: function( elem, className ) {
return elem && jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1;
}
},
// A method for quickly swapping in/out CSS properties to get correct calculations
swap: function( elem, options, callback ) {
var old = {};
// Remember the old values, and insert the new ones
for ( var name in options ) {
old[ name ] = elem.style[ name ];
elem.style[ name ] = options[ name ];
}
callback.call( elem );
// Revert the old values
for ( var name in options )
elem.style[ name ] = old[ name ];
},
css: function( elem, name, force, extra ) {
if ( name == "width" || name == "height" ) {
var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ];
function getWH() {
val = name == "width" ? elem.offsetWidth : elem.offsetHeight;
if ( extra === "border" )
return;
jQuery.each( which, function() {
if ( !extra )
val -= parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0;
if ( extra === "margin" )
val += parseFloat(jQuery.curCSS( elem, "margin" + this, true)) || 0;
else
val -= parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0;
});
}
if ( elem.offsetWidth !== 0 )
getWH();
else
jQuery.swap( elem, props, getWH );
return Math.max(0, Math.round(val));
}
return jQuery.curCSS( elem, name, force );
},
curCSS: function( elem, name, force ) {
var ret, style = elem.style;
// We need to handle opacity special in IE
if ( name == "opacity" && !jQuery.support.opacity ) {
ret = jQuery.attr( style, "opacity" );
return ret == "" ?
"1" :
ret;
}
// Make sure we're using the right name for getting the float value
if ( name.match( /float/i ) )
name = styleFloat;
if ( !force && style && style[ name ] )
ret = style[ name ];
else if ( defaultView.getComputedStyle ) {
// Only "float" is needed here
if ( name.match( /float/i ) )
name = "float";
name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase();
var computedStyle = defaultView.getComputedStyle( elem, null );
if ( computedStyle )
ret = computedStyle.getPropertyValue( name );
// We should always get a number back from opacity
if ( name == "opacity" && ret == "" )
ret = "1";
} else if ( elem.currentStyle ) {
var camelCase = name.replace(/\-(\w)/g, function(all, letter){
return letter.toUpperCase();
});
ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ];
// From the awesome hack by Dean Edwards
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
// If we're not dealing with a regular pixel number
// but a number that has a weird ending, we need to convert it to pixels
if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) {
// Remember the original values
var left = style.left, rsLeft = elem.runtimeStyle.left;
// Put in the new values to get a computed value out
elem.runtimeStyle.left = elem.currentStyle.left;
style.left = ret || 0;
ret = style.pixelLeft + "px";
// Revert the changed values
style.left = left;
elem.runtimeStyle.left = rsLeft;
}
}
return ret;
},
clean: function( elems, context, fragment ) {
context = context || document;
// !context.createElement fails in IE with an error but returns typeof 'object'
if ( typeof context.createElement === "undefined" )
context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
// If a single string is passed in and it's a single tag
// just do a createElement and skip the rest
if ( !fragment && elems.length === 1 && typeof elems[0] === "string" ) {
var match = /^<(\w+)\s*\/?>$/.exec(elems[0]);
if ( match )
return [ context.createElement( match[1] ) ];
}
var ret = [], scripts = [], div = context.createElement("div");
jQuery.each(elems, function(i, elem){
if ( typeof elem === "number" )
elem += '';
if ( !elem )
return;
// Convert html string into DOM nodes
if ( typeof elem === "string" ) {
// Fix "XHTML"-style tags in all browsers
elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){
return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ?
all :
front + "></" + tag + ">";
});
// Trim whitespace, otherwise indexOf won't work as expected
var tags = elem.replace(/^\s+/, "").substring(0, 10).toLowerCase();
var wrap =
// option or optgroup
!tags.indexOf("<opt") &&
[ 1, "<select multiple='multiple'>", "</select>" ] ||
!tags.indexOf("<leg") &&
[ 1, "<fieldset>", "</fieldset>" ] ||
tags.match(/^<(thead|tbody|tfoot|colg|cap)/) &&
[ 1, "<table>", "</table>" ] ||
!tags.indexOf("<tr") &&
[ 2, "<table><tbody>", "</tbody></table>" ] ||
// <thead> matched above
(!tags.indexOf("<td") || !tags.indexOf("<th")) &&
[ 3, "<table><tbody><tr>", "</tr></tbody></table>" ] ||
!tags.indexOf("<col") &&
[ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ] ||
// IE can't serialize <link> and <script> tags normally
!jQuery.support.htmlSerialize &&
[ 1, "div<div>", "</div>" ] ||
[ 0, "", "" ];
// Go to html and back, then peel off extra wrappers
div.innerHTML = wrap[1] + elem + wrap[2];
// Move to the right depth
while ( wrap[0]-- )
div = div.lastChild;
// Remove IE's autoinserted <tbody> from table fragments
if ( !jQuery.support.tbody ) {
// String was a <table>, *may* have spurious <tbody>
var hasBody = /<tbody/i.test(elem),
tbody = !tags.indexOf("<table") && !hasBody ?
div.firstChild && div.firstChild.childNodes :
// String was a bare <thead> or <tfoot>
wrap[1] == "<table>" && !hasBody ?
div.childNodes :
[];
for ( var j = tbody.length - 1; j >= 0 ; --j )
if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length )
tbody[ j ].parentNode.removeChild( tbody[ j ] );
}
// IE completely kills leading whitespace when innerHTML is used
if ( !jQuery.support.leadingWhitespace && /^\s/.test( elem ) )
div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild );
elem = jQuery.makeArray( div.childNodes );
}
if ( elem.nodeType )
ret.push( elem );
else
ret = jQuery.merge( ret, elem );
});
if ( fragment ) {
for ( var i = 0; ret[i]; i++ ) {
if ( jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
} else {
if ( ret[i].nodeType === 1 )
ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) );
fragment.appendChild( ret[i] );
}
}
return scripts;
}
return ret;
},
attr: function( elem, name, value ) {
// don't set attributes on text and comment nodes
if (!elem || elem.nodeType == 3 || elem.nodeType == 8)
return undefined;
var notxml = !jQuery.isXMLDoc( elem ),
// Whether we are setting (or getting)
set = value !== undefined;
// Try to normalize/fix the name
name = notxml && jQuery.props[ name ] || name;
// Only do all the following if this is a node (faster for style)
// IE elem.getAttribute passes even for style
if ( elem.tagName ) {
// These attributes require special treatment
var special = /href|src|style/.test( name );
// Safari mis-reports the default selected property of a hidden option
// Accessing the parent's selectedIndex property fixes it
if ( name == "selected" && elem.parentNode )
elem.parentNode.selectedIndex;
// If applicable, access the attribute via the DOM 0 way
if ( name in elem && notxml && !special ) {
if ( set ){
// We can't allow the type property to be changed (since it causes problems in IE)
if ( name == "type" && jQuery.nodeName( elem, "input" ) && elem.parentNode )
throw "type property can't be changed";
elem[ name ] = value;
}
// browsers index elements by id/name on forms, give priority to attributes.
if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) )
return elem.getAttributeNode( name ).nodeValue;
// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
if ( name == "tabIndex" ) {
var attributeNode = elem.getAttributeNode( "tabIndex" );
return attributeNode && attributeNode.specified
? attributeNode.value
: elem.nodeName.match(/(button|input|object|select|textarea)/i)
? 0
: elem.nodeName.match(/^(a|area)$/i) && elem.href
? 0
: undefined;
}
return elem[ name ];
}
if ( !jQuery.support.style && notxml && name == "style" )
return jQuery.attr( elem.style, "cssText", value );
if ( set )
// convert the value to a string (all browsers do this but IE) see #1070
elem.setAttribute( name, "" + value );
var attr = !jQuery.support.hrefNormalized && notxml && special
// Some attributes require a special call on IE
? elem.getAttribute( name, 2 )
: elem.getAttribute( name );
// Non-existent attributes return null, we normalize to undefined
return attr === null ? undefined : attr;
}
// elem is actually elem.style ... set the style
// IE uses filters for opacity
if ( !jQuery.support.opacity && name == "opacity" ) {
if ( set ) {
// IE has trouble with opacity if it does not have layout
// Force it by setting the zoom level
elem.zoom = 1;
// Set the alpha filter to set the opacity
elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) +
(parseInt( value ) + '' == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")");
}
return elem.filter && elem.filter.indexOf("opacity=") >= 0 ?
(parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100) + '':
"";
}
name = name.replace(/-([a-z])/ig, function(all, letter){
return letter.toUpperCase();
});
if ( set )
elem[ name ] = value;
return elem[ name ];
},
trim: function( text ) {
return (text || "").replace( /^\s+|\s+$/g, "" );
},
makeArray: function( array ) {
var ret = [];
if( array != null ){
var i = array.length;
// The window, strings (and functions) also have 'length'
if( i == null || typeof array === "string" || jQuery.isFunction(array) || array.setInterval )
ret[0] = array;
else
while( i )
ret[--i] = array[i];
}
return ret;
},
inArray: function( elem, array ) {
for ( var i = 0, length = array.length; i < length; i++ )
// Use === because on IE, window == document
if ( array[ i ] === elem )
return i;
return -1;
},
merge: function( first, second ) {
// We have to loop this way because IE & Opera overwrite the length
// expando of getElementsByTagName
var i = 0, elem, pos = first.length;
// Also, we need to make sure that the correct elements are being returned
// (IE returns comment nodes in a '*' query)
if ( !jQuery.support.getAll ) {
while ( (elem = second[ i++ ]) != null )
if ( elem.nodeType != 8 )
first[ pos++ ] = elem;
} else
while ( (elem = second[ i++ ]) != null )
first[ pos++ ] = elem;
return first;
},
unique: function( array ) {
var ret = [], done = {};
try {
for ( var i = 0, length = array.length; i < length; i++ ) {
var id = jQuery.data( array[ i ] );
if ( !done[ id ] ) {
done[ id ] = true;
ret.push( array[ i ] );
}
}
} catch( e ) {
ret = array;
}
return ret;
},
grep: function( elems, callback, inv ) {
var ret = [];
// Go through the array, only saving the items
// that pass the validator function
for ( var i = 0, length = elems.length; i < length; i++ )
if ( !inv != !callback( elems[ i ], i ) )
ret.push( elems[ i ] );
return ret;
},
map: function( elems, callback ) {
var ret = [];
// Go through the array, translating each of the items to their
// new value (or values).
for ( var i = 0, length = elems.length; i < length; i++ ) {
var value = callback( elems[ i ], i );
if ( value != null )
ret[ ret.length ] = value;
}
return ret.concat.apply( [], ret );
}
});
// Use of jQuery.browser is deprecated.
// It's included for backwards compatibility and plugins,
// although they should work to migrate away.
var userAgent = navigator.userAgent.toLowerCase();
// Figure out what browser is being used
jQuery.browser = {
version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1],
safari: /webkit/.test( userAgent ),
opera: /opera/.test( userAgent ),
msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
};
jQuery.each({
parent: function(elem){return elem.parentNode;},
parents: function(elem){return jQuery.dir(elem,"parentNode");},
next: function(elem){return jQuery.nth(elem,2,"nextSibling");},
prev: function(elem){return jQuery.nth(elem,2,"previousSibling");},
nextAll: function(elem){return jQuery.dir(elem,"nextSibling");},
prevAll: function(elem){return jQuery.dir(elem,"previousSibling");},
siblings: function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},
children: function(elem){return jQuery.sibling(elem.firstChild);},
contents: function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}
}, function(name, fn){
jQuery.fn[ name ] = function( selector ) {
var ret = jQuery.map( this, fn );
if ( selector && typeof selector == "string" )
ret = jQuery.multiFilter( selector, ret );
return this.pushStack( jQuery.unique( ret ), name, selector );
};
});
jQuery.each({
appendTo: "append",
prependTo: "prepend",
insertBefore: "before",
insertAfter: "after",
replaceAll: "replaceWith"
}, function(name, original){
jQuery.fn[ name ] = function( selector ) {
var ret = [], insert = jQuery( selector );
for ( var i = 0, l = insert.length; i < l; i++ ) {
var elems = (i > 0 ? this.clone(true) : this).get();
jQuery.fn[ original ].apply( jQuery(insert[i]), elems );
ret = ret.concat( elems );
}
return this.pushStack( ret, name, selector );
};
});
jQuery.each({
removeAttr: function( name ) {
jQuery.attr( this, name, "" );
if (this.nodeType == 1)
this.removeAttribute( name );
},
addClass: function( classNames ) {
jQuery.className.add( this, classNames );
},
removeClass: function( classNames ) {
jQuery.className.remove( this, classNames );
},
toggleClass: function( classNames, state ) {
if( typeof state !== "boolean" )
state = !jQuery.className.has( this, classNames );
jQuery.className[ state ? "add" : "remove" ]( this, classNames );
},
remove: function( selector ) {
if ( !selector || jQuery.filter( selector, [ this ] ).length ) {
// Prevent memory leaks
jQuery( "*", this ).add([this]).each(function(){
jQuery.event.remove(this);
jQuery.removeData(this);
});
if (this.parentNode)
this.parentNode.removeChild( this );
}
},
empty: function() {
// Remove element nodes and prevent memory leaks
jQuery(this).children().remove();
// Remove any remaining nodes
while ( this.firstChild )
this.removeChild( this.firstChild );
}
}, function(name, fn){
jQuery.fn[ name ] = function(){
return this.each( fn, arguments );
};
});
// Helper function used by the dimensions and offset modules
function num(elem, prop) {
return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0;
}
var expando = "jQuery" + now(), uuid = 0, windowData = {};
jQuery.extend({
cache: {},
data: function( elem, name, data ) {
elem = elem == window ?
windowData :
elem;
var id = elem[ expando ];
// Compute a unique ID for the element
if ( !id )
id = elem[ expando ] = ++uuid;
// Only generate the data cache if we're
// trying to access or manipulate it
if ( name && !jQuery.cache[ id ] )
jQuery.cache[ id ] = {};
// Prevent overriding the named cache with undefined values
if ( data !== undefined )
jQuery.cache[ id ][ name ] = data;
// Return the named cache data, or the ID for the element
return name ?
jQuery.cache[ id ][ name ] :
id;
},
removeData: function( elem, name ) {
elem = elem == window ?
windowData :
elem;
var id = elem[ expando ];
// If we want to remove a specific section of the element's data
if ( name ) {
if ( jQuery.cache[ id ] ) {
// Remove the section of cache data
delete jQuery.cache[ id ][ name ];
// If we've removed all the data, remove the element's cache
name = "";
for ( name in jQuery.cache[ id ] )
break;
if ( !name )
jQuery.removeData( elem );
}
// Otherwise, we want to remove all of the element's data
} else {
// Clean up the element expando
try {
delete elem[ expando ];
} catch(e){
// IE has trouble directly removing the expando
// but it's ok with using removeAttribute
if ( elem.removeAttribute )
elem.removeAttribute( expando );
}
// Completely remove the data cache
delete jQuery.cache[ id ];
}
},
queue: function( elem, type, data ) {
if ( elem ){
type = (type || "fx") + "queue";
var q = jQuery.data( elem, type );
if ( !q || jQuery.isArray(data) )
q = jQuery.data( elem, type, jQuery.makeArray(data) );
else if( data )
q.push( data );
}
return q;
},
dequeue: function( elem, type ){
var queue = jQuery.queue( elem, type ),
fn = queue.shift();
if( !type || type === "fx" )
fn = queue[0];
if( fn !== undefined )
fn.call(elem);
}
});
jQuery.fn.extend({
data: function( key, value ){
var parts = key.split(".");
parts[1] = parts[1] ? "." + parts[1] : "";
if ( value === undefined ) {
var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
if ( data === undefined && this.length )
data = jQuery.data( this[0], key );
return data === undefined && parts[1] ?
this.data( parts[0] ) :
data;
} else
return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){
jQuery.data( this, key, value );
});
},
removeData: function( key ){
return this.each(function(){
jQuery.removeData( this, key );
});
},
queue: function(type, data){
if ( typeof type !== "string" ) {
data = type;
type = "fx";
}
if ( data === undefined )
return jQuery.queue( this[0], type );
return this.each(function(){
var queue = jQuery.queue( this, type, data );
if( type == "fx" && queue.length == 1 )
queue[0].call(this);
});
},
dequeue: function(type){
return this.each(function(){
jQuery.dequeue( this, type );
});
}
});/*!
* Sizzle CSS Selector Engine - v0.9.3
* Copyright 2009, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
* More information: http://sizzlejs.com/
*/
(function(){
var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,
done = 0,
toString = Object.prototype.toString;
var Sizzle = function(selector, context, results, seed) {
results = results || [];
context = context || document;
if ( context.nodeType !== 1 && context.nodeType !== 9 )
return [];
if ( !selector || typeof selector !== "string" ) {
return results;
}
var parts = [], m, set, checkSet, check, mode, extra, prune = true;
// Reset the position of the chunker regexp (start from head)
chunker.lastIndex = 0;
while ( (m = chunker.exec(selector)) !== null ) {
parts.push( m[1] );
if ( m[2] ) {
extra = RegExp.rightContext;
break;
}
}
if ( parts.length > 1 && origPOS.exec( selector ) ) {
if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
set = posProcess( parts[0] + parts[1], context );
} else {
set = Expr.relative[ parts[0] ] ?
[ context ] :
Sizzle( parts.shift(), context );
while ( parts.length ) {
selector = parts.shift();
if ( Expr.relative[ selector ] )
selector += parts.shift();
set = posProcess( selector, set );
}
}
} else {
var ret = seed ?
{ expr: parts.pop(), set: makeArray(seed) } :
Sizzle.find( parts.pop(), parts.length === 1 && context.parentNode ? context.parentNode : context, isXML(context) );
set = Sizzle.filter( ret.expr, ret.set );
if ( parts.length > 0 ) {
checkSet = makeArray(set);
} else {
prune = false;
}
while ( parts.length ) {
var cur = parts.pop(), pop = cur;
if ( !Expr.relative[ cur ] ) {
cur = "";
} else {
pop = parts.pop();
}
if ( pop == null ) {
pop = context;
}
Expr.relative[ cur ]( checkSet, pop, isXML(context) );
}
}
if ( !checkSet ) {
checkSet = set;
}
if ( !checkSet ) {
throw "Syntax error, unrecognized expression: " + (cur || selector);
}
if ( toString.call(checkSet) === "[object Array]" ) {
if ( !prune ) {
results.push.apply( results, checkSet );
} else if ( context.nodeType === 1 ) {
for ( var i = 0; checkSet[i] != null; i++ ) {
if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) {
results.push( set[i] );
}
}
} else {
for ( var i = 0; checkSet[i] != null; i++ ) {
if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
results.push( set[i] );
}
}
}
} else {
makeArray( checkSet, results );
}
if ( extra ) {
Sizzle( extra, context, results, seed );
if ( sortOrder ) {
hasDuplicate = false;
results.sort(sortOrder);
if ( hasDuplicate ) {
for ( var i = 1; i < results.length; i++ ) {
if ( results[i] === results[i-1] ) {
results.splice(i--, 1);
}
}
}
}
}
return results;
};
Sizzle.matches = function(expr, set){
return Sizzle(expr, null, null, set);
};
Sizzle.find = function(expr, context, isXML){
var set, match;
if ( !expr ) {
return [];
}
for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
var type = Expr.order[i], match;
if ( (match = Expr.match[ type ].exec( expr )) ) {
var left = RegExp.leftContext;
if ( left.substr( left.length - 1 ) !== "\\" ) {
match[1] = (match[1] || "").replace(/\\/g, "");
set = Expr.find[ type ]( match, context, isXML );
if ( set != null ) {
expr = expr.replace( Expr.match[ type ], "" );
break;
}
}
}
}
if ( !set ) {
set = context.getElementsByTagName("*");
}
return {set: set, expr: expr};
};
Sizzle.filter = function(expr, set, inplace, not){
var old = expr, result = [], curLoop = set, match, anyFound,
isXMLFilter = set && set[0] && isXML(set[0]);
while ( expr && set.length ) {
for ( var type in Expr.filter ) {
if ( (match = Expr.match[ type ].exec( expr )) != null ) {
var filter = Expr.filter[ type ], found, item;
anyFound = false;
if ( curLoop == result ) {
result = [];
}
if ( Expr.preFilter[ type ] ) {
match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
if ( !match ) {
anyFound = found = true;
} else if ( match === true ) {
continue;
}
}
if ( match ) {
for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
if ( item ) {
found = filter( item, match, i, curLoop );
var pass = not ^ !!found;
if ( inplace && found != null ) {
if ( pass ) {
anyFound = true;
} else {
curLoop[i] = false;
}
} else if ( pass ) {
result.push( item );
anyFound = true;
}
}
}
}
if ( found !== undefined ) {
if ( !inplace ) {
curLoop = result;
}
expr = expr.replace( Expr.match[ type ], "" );
if ( !anyFound ) {
return [];
}
break;
}
}
}
// Improper expression
if ( expr == old ) {
if ( anyFound == null ) {
throw "Syntax error, unrecognized expression: " + expr;
} else {
break;
}
}
old = expr;
}
return curLoop;
};
var Expr = Sizzle.selectors = {
order: [ "ID", "NAME", "TAG" ],
match: {
ID: /#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,
CLASS: /\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,
NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,
ATTR: /\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
TAG: /^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,
CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,
POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,
PSEUDO: /:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/
},
attrMap: {
"class": "className",
"for": "htmlFor"
},
attrHandle: {
href: function(elem){
return elem.getAttribute("href");
}
},
relative: {
"+": function(checkSet, part, isXML){
var isPartStr = typeof part === "string",
isTag = isPartStr && !/\W/.test(part),
isPartStrNotTag = isPartStr && !isTag;
if ( isTag && !isXML ) {
part = part.toUpperCase();
}
for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
if ( (elem = checkSet[i]) ) {
while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
checkSet[i] = isPartStrNotTag || elem && elem.nodeName === part ?
elem || false :
elem === part;
}
}
if ( isPartStrNotTag ) {
Sizzle.filter( part, checkSet, true );
}
},
">": function(checkSet, part, isXML){
var isPartStr = typeof part === "string";
if ( isPartStr && !/\W/.test(part) ) {
part = isXML ? part : part.toUpperCase();
for ( var i = 0, l = checkSet.length; i < l; i++ ) {
var elem = checkSet[i];
if ( elem ) {
var parent = elem.parentNode;
checkSet[i] = parent.nodeName === part ? parent : false;
}
}
} else {
for ( var i = 0, l = checkSet.length; i < l; i++ ) {
var elem = checkSet[i];
if ( elem ) {
checkSet[i] = isPartStr ?
elem.parentNode :
elem.parentNode === part;
}
}
if ( isPartStr ) {
Sizzle.filter( part, checkSet, true );
}
}
},
"": function(checkSet, part, isXML){
var doneName = done++, checkFn = dirCheck;
if ( !part.match(/\W/) ) {
var nodeCheck = part = isXML ? part : part.toUpperCase();
checkFn = dirNodeCheck;
}
checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML);
},
"~": function(checkSet, part, isXML){
var doneName = done++, checkFn = dirCheck;
if ( typeof part === "string" && !part.match(/\W/) ) {
var nodeCheck = part = isXML ? part : part.toUpperCase();
checkFn = dirNodeCheck;
}
checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML);
}
},
find: {
ID: function(match, context, isXML){
if ( typeof context.getElementById !== "undefined" && !isXML ) {
var m = context.getElementById(match[1]);
return m ? [m] : [];
}
},
NAME: function(match, context, isXML){
if ( typeof context.getElementsByName !== "undefined" ) {
var ret = [], results = context.getElementsByName(match[1]);
for ( var i = 0, l = results.length; i < l; i++ ) {
if ( results[i].getAttribute("name") === match[1] ) {
ret.push( results[i] );
}
}
return ret.length === 0 ? null : ret;
}
},
TAG: function(match, context){
return context.getElementsByTagName(match[1]);
}
},
preFilter: {
CLASS: function(match, curLoop, inplace, result, not, isXML){
match = " " + match[1].replace(/\\/g, "") + " ";
if ( isXML ) {
return match;
}
for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
if ( elem ) {
if ( not ^ (elem.className && (" " + elem.className + " ").indexOf(match) >= 0) ) {
if ( !inplace )
result.push( elem );
} else if ( inplace ) {
curLoop[i] = false;
}
}
}
return false;
},
ID: function(match){
return match[1].replace(/\\/g, "");
},
TAG: function(match, curLoop){
for ( var i = 0; curLoop[i] === false; i++ ){}
return curLoop[i] && isXML(curLoop[i]) ? match[1] : match[1].toUpperCase();
},
CHILD: function(match){
if ( match[1] == "nth" ) {
// parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
match[2] == "even" && "2n" || match[2] == "odd" && "2n+1" ||
!/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
// calculate the numbers (first)n+(last) including if they are negative
match[2] = (test[1] + (test[2] || 1)) - 0;
match[3] = test[3] - 0;
}
// TODO: Move to normal caching system
match[0] = done++;
return match;
},
ATTR: function(match, curLoop, inplace, result, not, isXML){
var name = match[1].replace(/\\/g, "");
if ( !isXML && Expr.attrMap[name] ) {
match[1] = Expr.attrMap[name];
}
if ( match[2] === "~=" ) {
match[4] = " " + match[4] + " ";
}
return match;
},
PSEUDO: function(match, curLoop, inplace, result, not){
if ( match[1] === "not" ) {
// If we're dealing with a complex expression, or a simple one
if ( match[3].match(chunker).length > 1 || /^\w/.test(match[3]) ) {
match[3] = Sizzle(match[3], null, null, curLoop);
} else {
var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
if ( !inplace ) {
result.push.apply( result, ret );
}
return false;
}
} else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
return true;
}
return match;
},
POS: function(match){
match.unshift( true );
return match;
}
},
filters: {
enabled: function(elem){
return elem.disabled === false && elem.type !== "hidden";
},
disabled: function(elem){
return elem.disabled === true;
},
checked: function(elem){
return elem.checked === true;
},
selected: function(elem){
// Accessing this property makes selected-by-default
// options in Safari work properly
elem.parentNode.selectedIndex;
return elem.selected === true;
},
parent: function(elem){
return !!elem.firstChild;
},
empty: function(elem){
return !elem.firstChild;
},
has: function(elem, i, match){
return !!Sizzle( match[3], elem ).length;
},
header: function(elem){
return /h\d/i.test( elem.nodeName );
},
text: function(elem){
return "text" === elem.type;
},
radio: function(elem){
return "radio" === elem.type;
},
checkbox: function(elem){
return "checkbox" === elem.type;
},
file: function(elem){
return "file" === elem.type;
},
password: function(elem){
return "password" === elem.type;
},
submit: function(elem){
return "submit" === elem.type;
},
image: function(elem)
Untitled JavaScript (17-Jul @ 14:27)
Syntax Highlighted Code
- /*!
- * jQuery JavaScript Library v1.3.2
- * http://jquery.com/
- *
- [1894 more lines...]
Plain Code
/*!
* jQuery JavaScript Library v1.3.2
* http://jquery.com/
*
* Copyright (c) 2009 John Resig
* Dual licensed under the MIT and GPL licenses.
* http://docs.jquery.com/License
*
* Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
* Revision: 6246
*/
(function(){
var
// Will speed up references to window, and allows munging its name.
window = this,
// Will speed up references to undefined, and allows munging its name.
undefined,
// Map over jQuery in case of overwrite
_jQuery = window.jQuery,
// Map over the $ in case of overwrite
_$ = window.$,
jQuery = window.jQuery = window.$ = function( selector, context ) {
// The jQuery object is actually just the init constructor 'enhanced'
return new jQuery.fn.init( selector, context );
},
// A simple way to check for HTML strings or ID strings
// (both of which we optimize for)
quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,
// Is it a simple selector
isSimple = /^.[^:#\[\.,]*$/;
jQuery.fn = jQuery.prototype = {
init: function( selector, context ) {
// Make sure that a selection was provided
selector = selector || document;
// Handle $(DOMElement)
if ( selector.nodeType ) {
this[0] = selector;
this.length = 1;
this.context = selector;
return this;
}
// Handle HTML strings
if ( typeof selector === "string" ) {
// Are we dealing with HTML string or an ID?
var match = quickExpr.exec( selector );
// Verify a match, and that no context was specified for #id
if ( match && (match[1] || !context) ) {
// HANDLE: $(html) -> $(array)
if ( match[1] )
selector = jQuery.clean( [ match[1] ], context );
// HANDLE: $("#id")
else {
var elem = document.getElementById( match[3] );
// Handle the case where IE and Opera return items
// by name instead of ID
if ( elem && elem.id != match[3] )
return jQuery().find( selector );
// Otherwise, we inject the element directly into the jQuery object
var ret = jQuery( elem || [] );
ret.context = document;
ret.selector = selector;
return ret;
}
// HANDLE: $(expr, [context])
// (which is just equivalent to: $(content).find(expr)
} else
return jQuery( context ).find( selector );
// HANDLE: $(function)
// Shortcut for document ready
} else if ( jQuery.isFunction( selector ) )
return jQuery( document ).ready( selector );
// Make sure that old selector state is passed along
if ( selector.selector && selector.context ) {
this.selector = selector.selector;
this.context = selector.context;
}
return this.setArray(jQuery.isArray( selector ) ?
selector :
jQuery.makeArray(selector));
},
// Start with an empty selector
selector: "",
// The current version of jQuery being used
jquery: "1.3.2",
// The number of elements contained in the matched element set
size: function() {
return this.length;
},
// Get the Nth element in the matched element set OR
// Get the whole matched element set as a clean array
get: function( num ) {
return num === undefined ?
// Return a 'clean' array
Array.prototype.slice.call( this ) :
// Return just the object
this[ num ];
},
// Take an array of elements and push it onto the stack
// (returning the new matched element set)
pushStack: function( elems, name, selector ) {
// Build a new jQuery matched element set
var ret = jQuery( elems );
// Add the old object onto the stack (as a reference)
ret.prevObject = this;
ret.context = this.context;
if ( name === "find" )
ret.selector = this.selector + (this.selector ? " " : "") + selector;
else if ( name )
ret.selector = this.selector + "." + name + "(" + selector + ")";
// Return the newly-formed element set
return ret;
},
// Force the current matched set of elements to become
// the specified array of elements (destroying the stack in the process)
// You should use pushStack() in order to do this, but maintain the stack
setArray: function( elems ) {
// Resetting the length to 0, then using the native Array push
// is a super-fast way to populate an object with array-like properties
this.length = 0;
Array.prototype.push.apply( this, elems );
return this;
},
// Execute a callback for every element in the matched set.
// (You can seed the arguments with an array of args, but this is
// only used internally.)
each: function( callback, args ) {
return jQuery.each( this, callback, args );
},
// Determine the position of an element within
// the matched set of elements
index: function( elem ) {
// Locate the position of the desired element
return jQuery.inArray(
// If it receives a jQuery object, the first element is used
elem && elem.jquery ? elem[0] : elem
, this );
},
attr: function( name, value, type ) {
var options = name;
// Look for the case where we're accessing a style value
if ( typeof name === "string" )
if ( value === undefined )
return this[0] && jQuery[ type || "attr" ]( this[0], name );
else {
options = {};
options[ name ] = value;
}
// Check to see if we're setting style values
return this.each(function(i){
// Set all the styles
for ( name in options )
jQuery.attr(
type ?
this.style :
this,
name, jQuery.prop( this, options[ name ], type, i, name )
);
});
},
css: function( key, value ) {
// ignore negative width and height values
if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 )
value = undefined;
return this.attr( key, value, "curCSS" );
},
text: function( text ) {
if ( typeof text !== "object" && text != null )
return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
var ret = "";
jQuery.each( text || this, function(){
jQuery.each( this.childNodes, function(){
if ( this.nodeType != 8 )
ret += this.nodeType != 1 ?
this.nodeValue :
jQuery.fn.text( [ this ] );
});
});
return ret;
},
wrapAll: function( html ) {
if ( this[0] ) {
// The elements to wrap the target around
var wrap = jQuery( html, this[0].ownerDocument ).clone();
if ( this[0].parentNode )
wrap.insertBefore( this[0] );
wrap.map(function(){
var elem = this;
while ( elem.firstChild )
elem = elem.firstChild;
return elem;
}).append(this);
}
return this;
},
wrapInner: function( html ) {
return this.each(function(){
jQuery( this ).contents().wrapAll( html );
});
},
wrap: function( html ) {
return this.each(function(){
jQuery( this ).wrapAll( html );
});
},
append: function() {
return this.domManip(arguments, true, function(elem){
if (this.nodeType == 1)
this.appendChild( elem );
});
},
prepend: function() {
return this.domManip(arguments, true, function(elem){
if (this.nodeType == 1)
this.insertBefore( elem, this.firstChild );
});
},
before: function() {
return this.domManip(arguments, false, function(elem){
this.parentNode.insertBefore( elem, this );
});
},
after: function() {
return this.domManip(arguments, false, function(elem){
this.parentNode.insertBefore( elem, this.nextSibling );
});
},
end: function() {
return this.prevObject || jQuery( [] );
},
// For internal use only.
// Behaves like an Array's method, not like a jQuery method.
push: [].push,
sort: [].sort,
splice: [].splice,
find: function( selector ) {
if ( this.length === 1 ) {
var ret = this.pushStack( [], "find", selector );
ret.length = 0;
jQuery.find( selector, this[0], ret );
return ret;
} else {
return this.pushStack( jQuery.unique(jQuery.map(this, function(elem){
return jQuery.find( selector, elem );
})), "find", selector );
}
},
clone: function( events ) {
// Do the clone
var ret = this.map(function(){
if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) {
// IE copies events bound via attachEvent when
// using cloneNode. Calling detachEvent on the
// clone will also remove the events from the orignal
// In order to get around this, we use innerHTML.
// Unfortunately, this means some modifications to
// attributes in IE that are actually only stored
// as properties will not be copied (such as the
// the name attribute on an input).
var html = this.outerHTML;
if ( !html ) {
var div = this.ownerDocument.createElement("div");
div.appendChild( this.cloneNode(true) );
html = div.innerHTML;
}
return jQuery.clean([html.replace(/ jQuery\d+="(?:\d+|null)"/g, "").replace(/^\s*/, "")])[0];
} else
return this.cloneNode(true);
});
// Copy the events from the original to the clone
if ( events === true ) {
var orig = this.find("*").andSelf(), i = 0;
ret.find("*").andSelf().each(function(){
if ( this.nodeName !== orig[i].nodeName )
return;
var events = jQuery.data( orig[i], "events" );
for ( var type in events ) {
for ( var handler in events[ type ] ) {
jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data );
}
}
i++;
});
}
// Return the cloned set
return ret;
},
filter: function( selector ) {
return this.pushStack(
jQuery.isFunction( selector ) &&
jQuery.grep(this, function(elem, i){
return selector.call( elem, i );
}) ||
jQuery.multiFilter( selector, jQuery.grep(this, function(elem){
return elem.nodeType === 1;
}) ), "filter", selector );
},
closest: function( selector ) {
var pos = jQuery.expr.match.POS.test( selector ) ? jQuery(selector) : null,
closer = 0;
return this.map(function(){
var cur = this;
while ( cur && cur.ownerDocument ) {
if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selector) ) {
jQuery.data(cur, "closest", closer);
return cur;
}
cur = cur.parentNode;
closer++;
}
});
},
not: function( selector ) {
if ( typeof selector === "string" )
// test special case where just one selector is passed in
if ( isSimple.test( selector ) )
return this.pushStack( jQuery.multiFilter( selector, this, true ), "not", selector );
else
selector = jQuery.multiFilter( selector, this );
var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType;
return this.filter(function() {
return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector;
});
},
add: function( selector ) {
return this.pushStack( jQuery.unique( jQuery.merge(
this.get(),
typeof selector === "string" ?
jQuery( selector ) :
jQuery.makeArray( selector )
)));
},
is: function( selector ) {
return !!selector && jQuery.multiFilter( selector, this ).length > 0;
},
hasClass: function( selector ) {
return !!selector && this.is( "." + selector );
},
val: function( value ) {
if ( value === undefined ) {
var elem = this[0];
if ( elem ) {
if( jQuery.nodeName( elem, 'option' ) )
return (elem.attributes.value || {}).specified ? elem.value : elem.text;
// We need to handle select boxes special
if ( jQuery.nodeName( elem, "select" ) ) {
var index = elem.selectedIndex,
values = [],
options = elem.options,
one = elem.type == "select-one";
// Nothing was selected
if ( index < 0 )
return null;
// Loop through all the selected options
for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
var option = options[ i ];
if ( option.selected ) {
// Get the specifc value for the option
value = jQuery(option).val();
// We don't need an array for one selects
if ( one )
return value;
// Multi-Selects return an array
values.push( value );
}
}
return values;
}
// Everything else, we just grab the value
return (elem.value || "").replace(/\r/g, "");
}
return undefined;
}
if ( typeof value === "number" )
value += '';
return this.each(function(){
if ( this.nodeType != 1 )
return;
if ( jQuery.isArray(value) && /radio|checkbox/.test( this.type ) )
this.checked = (jQuery.inArray(this.value, value) >= 0 ||
jQuery.inArray(this.name, value) >= 0);
else if ( jQuery.nodeName( this, "select" ) ) {
var values = jQuery.makeArray(value);
jQuery( "option", this ).each(function(){
this.selected = (jQuery.inArray( this.value, values ) >= 0 ||
jQuery.inArray( this.text, values ) >= 0);
});
if ( !values.length )
this.selectedIndex = -1;
} else
this.value = value;
});
},
html: function( value ) {
return value === undefined ?
(this[0] ?
this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g, "") :
null) :
this.empty().append( value );
},
replaceWith: function( value ) {
return this.after( value ).remove();
},
eq: function( i ) {
return this.slice( i, +i + 1 );
},
slice: function() {
return this.pushStack( Array.prototype.slice.apply( this, arguments ),
"slice", Array.prototype.slice.call(arguments).join(",") );
},
map: function( callback ) {
return this.pushStack( jQuery.map(this, function(elem, i){
return callback.call( elem, i, elem );
}));
},
andSelf: function() {
return this.add( this.prevObject );
},
domManip: function( args, table, callback ) {
if ( this[0] ) {
var fragment = (this[0].ownerDocument || this[0]).createDocumentFragment(),
scripts = jQuery.clean( args, (this[0].ownerDocument || this[0]), fragment ),
first = fragment.firstChild;
if ( first )
for ( var i = 0, l = this.length; i < l; i++ )
callback.call( root(this[i], first), this.length > 1 || i > 0 ?
fragment.cloneNode(true) : fragment );
if ( scripts )
jQuery.each( scripts, evalScript );
}
return this;
function root( elem, cur ) {
return table && jQuery.nodeName(elem, "table") && jQuery.nodeName(cur, "tr") ?
(elem.getElementsByTagName("tbody")[0] ||
elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
elem;
}
}
};
// Give the init function the jQuery prototype for later instantiation
jQuery.fn.init.prototype = jQuery.fn;
function evalScript( i, elem ) {
if ( elem.src )
jQuery.ajax({
url: elem.src,
async: false,
dataType: "script"
});
else
jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
if ( elem.parentNode )
elem.parentNode.removeChild( elem );
}
function now(){
return +new Date;
}
jQuery.extend = jQuery.fn.extend = function() {
// copy reference to target object
var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options;
// Handle a deep copy situation
if ( typeof target === "boolean" ) {
deep = target;
target = arguments[1] || {};
// skip the boolean and the target
i = 2;
}
// Handle case when target is a string or something (possible in deep copy)
if ( typeof target !== "object" && !jQuery.isFunction(target) )
target = {};
// extend jQuery itself if only one argument is passed
if ( length == i ) {
target = this;
--i;
}
for ( ; i < length; i++ )
// Only deal with non-null/undefined values
if ( (options = arguments[ i ]) != null )
// Extend the base object
for ( var name in options ) {
var src = target[ name ], copy = options[ name ];
// Prevent never-ending loop
if ( target === copy )
continue;
// Recurse if we're merging object values
if ( deep && copy && typeof copy === "object" && !copy.nodeType )
target[ name ] = jQuery.extend( deep,
// Never move original objects, clone them
src || ( copy.length != null ? [ ] : { } )
, copy );
// Don't bring in undefined values
else if ( copy !== undefined )
target[ name ] = copy;
}
// Return the modified object
return target;
};
// exclude the following css properties to add px
var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
// cache defaultView
defaultView = document.defaultView || {},
toString = Object.prototype.toString;
jQuery.extend({
noConflict: function( deep ) {
window.$ = _$;
if ( deep )
window.jQuery = _jQuery;
return jQuery;
},
// See test/unit/core.js for details concerning isFunction.
// Since version 1.3, DOM methods and functions like alert
// aren't supported. They return false on IE (#2968).
isFunction: function( obj ) {
return toString.call(obj) === "[object Function]";
},
isArray: function( obj ) {
return toString.call(obj) === "[object Array]";
},
// check if an element is in a (or is an) XML document
isXMLDoc: function( elem ) {
return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" ||
!!elem.ownerDocument && jQuery.isXMLDoc( elem.ownerDocument );
},
// Evalulates a script in a global context
globalEval: function( data ) {
if ( data && /\S/.test(data) ) {
// Inspired by code by Andrea Giammarchi
// http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
var head = document.getElementsByTagName("head")[0] || document.documentElement,
script = document.createElement("script");
script.type = "text/javascript";
if ( jQuery.support.scriptEval )
script.appendChild( document.createTextNode( data ) );
else
script.text = data;
// Use insertBefore instead of appendChild to circumvent an IE6 bug.
// This arises when a base node is used (#2709).
head.insertBefore( script, head.firstChild );
head.removeChild( script );
}
},
nodeName: function( elem, name ) {
return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
},
// args is for internal usage only
each: function( object, callback, args ) {
var name, i = 0, length = object.length;
if ( args ) {
if ( length === undefined ) {
for ( name in object )
if ( callback.apply( object[ name ], args ) === false )
break;
} else
for ( ; i < length; )
if ( callback.apply( object[ i++ ], args ) === false )
break;
// A special, fast, case for the most common use of each
} else {
if ( length === undefined ) {
for ( name in object )
if ( callback.call( object[ name ], name, object[ name ] ) === false )
break;
} else
for ( var value = object[0];
i < length && callback.call( value, i, value ) !== false; value = object[++i] ){}
}
return object;
},
prop: function( elem, value, type, i, name ) {
// Handle executable functions
if ( jQuery.isFunction( value ) )
value = value.call( elem, i );
// Handle passing in a number to a CSS property
return typeof value === "number" && type == "curCSS" && !exclude.test( name ) ?
value + "px" :
value;
},
className: {
// internal only, use addClass("class")
add: function( elem, classNames ) {
jQuery.each((classNames || "").split(/\s+/), function(i, className){
if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) )
elem.className += (elem.className ? " " : "") + className;
});
},
// internal only, use removeClass("class")
remove: function( elem, classNames ) {
if (elem.nodeType == 1)
elem.className = classNames !== undefined ?
jQuery.grep(elem.className.split(/\s+/), function(className){
return !jQuery.className.has( classNames, className );
}).join(" ") :
"";
},
// internal only, use hasClass("class")
has: function( elem, className ) {
return elem && jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1;
}
},
// A method for quickly swapping in/out CSS properties to get correct calculations
swap: function( elem, options, callback ) {
var old = {};
// Remember the old values, and insert the new ones
for ( var name in options ) {
old[ name ] = elem.style[ name ];
elem.style[ name ] = options[ name ];
}
callback.call( elem );
// Revert the old values
for ( var name in options )
elem.style[ name ] = old[ name ];
},
css: function( elem, name, force, extra ) {
if ( name == "width" || name == "height" ) {
var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ];
function getWH() {
val = name == "width" ? elem.offsetWidth : elem.offsetHeight;
if ( extra === "border" )
return;
jQuery.each( which, function() {
if ( !extra )
val -= parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0;
if ( extra === "margin" )
val += parseFloat(jQuery.curCSS( elem, "margin" + this, true)) || 0;
else
val -= parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0;
});
}
if ( elem.offsetWidth !== 0 )
getWH();
else
jQuery.swap( elem, props, getWH );
return Math.max(0, Math.round(val));
}
return jQuery.curCSS( elem, name, force );
},
curCSS: function( elem, name, force ) {
var ret, style = elem.style;
// We need to handle opacity special in IE
if ( name == "opacity" && !jQuery.support.opacity ) {
ret = jQuery.attr( style, "opacity" );
return ret == "" ?
"1" :
ret;
}
// Make sure we're using the right name for getting the float value
if ( name.match( /float/i ) )
name = styleFloat;
if ( !force && style && style[ name ] )
ret = style[ name ];
else if ( defaultView.getComputedStyle ) {
// Only "float" is needed here
if ( name.match( /float/i ) )
name = "float";
name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase();
var computedStyle = defaultView.getComputedStyle( elem, null );
if ( computedStyle )
ret = computedStyle.getPropertyValue( name );
// We should always get a number back from opacity
if ( name == "opacity" && ret == "" )
ret = "1";
} else if ( elem.currentStyle ) {
var camelCase = name.replace(/\-(\w)/g, function(all, letter){
return letter.toUpperCase();
});
ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ];
// From the awesome hack by Dean Edwards
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
// If we're not dealing with a regular pixel number
// but a number that has a weird ending, we need to convert it to pixels
if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) {
// Remember the original values
var left = style.left, rsLeft = elem.runtimeStyle.left;
// Put in the new values to get a computed value out
elem.runtimeStyle.left = elem.currentStyle.left;
style.left = ret || 0;
ret = style.pixelLeft + "px";
// Revert the changed values
style.left = left;
elem.runtimeStyle.left = rsLeft;
}
}
return ret;
},
clean: function( elems, context, fragment ) {
context = context || document;
// !context.createElement fails in IE with an error but returns typeof 'object'
if ( typeof context.createElement === "undefined" )
context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
// If a single string is passed in and it's a single tag
// just do a createElement and skip the rest
if ( !fragment && elems.length === 1 && typeof elems[0] === "string" ) {
var match = /^<(\w+)\s*\/?>$/.exec(elems[0]);
if ( match )
return [ context.createElement( match[1] ) ];
}
var ret = [], scripts = [], div = context.createElement("div");
jQuery.each(elems, function(i, elem){
if ( typeof elem === "number" )
elem += '';
if ( !elem )
return;
// Convert html string into DOM nodes
if ( typeof elem === "string" ) {
// Fix "XHTML"-style tags in all browsers
elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){
return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ?
all :
front + "></" + tag + ">";
});
// Trim whitespace, otherwise indexOf won't work as expected
var tags = elem.replace(/^\s+/, "").substring(0, 10).toLowerCase();
var wrap =
// option or optgroup
!tags.indexOf("<opt") &&
[ 1, "<select multiple='multiple'>", "</select>" ] ||
!tags.indexOf("<leg") &&
[ 1, "<fieldset>", "</fieldset>" ] ||
tags.match(/^<(thead|tbody|tfoot|colg|cap)/) &&
[ 1, "<table>", "</table>" ] ||
!tags.indexOf("<tr") &&
[ 2, "<table><tbody>", "</tbody></table>" ] ||
// <thead> matched above
(!tags.indexOf("<td") || !tags.indexOf("<th")) &&
[ 3, "<table><tbody><tr>", "</tr></tbody></table>" ] ||
!tags.indexOf("<col") &&
[ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ] ||
// IE can't serialize <link> and <script> tags normally
!jQuery.support.htmlSerialize &&
[ 1, "div<div>", "</div>" ] ||
[ 0, "", "" ];
// Go to html and back, then peel off extra wrappers
div.innerHTML = wrap[1] + elem + wrap[2];
// Move to the right depth
while ( wrap[0]-- )
div = div.lastChild;
// Remove IE's autoinserted <tbody> from table fragments
if ( !jQuery.support.tbody ) {
// String was a <table>, *may* have spurious <tbody>
var hasBody = /<tbody/i.test(elem),
tbody = !tags.indexOf("<table") && !hasBody ?
div.firstChild && div.firstChild.childNodes :
// String was a bare <thead> or <tfoot>
wrap[1] == "<table>" && !hasBody ?
div.childNodes :
[];
for ( var j = tbody.length - 1; j >= 0 ; --j )
if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length )
tbody[ j ].parentNode.removeChild( tbody[ j ] );
}
// IE completely kills leading whitespace when innerHTML is used
if ( !jQuery.support.leadingWhitespace && /^\s/.test( elem ) )
div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild );
elem = jQuery.makeArray( div.childNodes );
}
if ( elem.nodeType )
ret.push( elem );
else
ret = jQuery.merge( ret, elem );
});
if ( fragment ) {
for ( var i = 0; ret[i]; i++ ) {
if ( jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
} else {
if ( ret[i].nodeType === 1 )
ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) );
fragment.appendChild( ret[i] );
}
}
return scripts;
}
return ret;
},
attr: function( elem, name, value ) {
// don't set attributes on text and comment nodes
if (!elem || elem.nodeType == 3 || elem.nodeType == 8)
return undefined;
var notxml = !jQuery.isXMLDoc( elem ),
// Whether we are setting (or getting)
set = value !== undefined;
// Try to normalize/fix the name
name = notxml && jQuery.props[ name ] || name;
// Only do all the following if this is a node (faster for style)
// IE elem.getAttribute passes even for style
if ( elem.tagName ) {
// These attributes require special treatment
var special = /href|src|style/.test( name );
// Safari mis-reports the default selected property of a hidden option
// Accessing the parent's selectedIndex property fixes it
if ( name == "selected" && elem.parentNode )
elem.parentNode.selectedIndex;
// If applicable, access the attribute via the DOM 0 way
if ( name in elem && notxml && !special ) {
if ( set ){
// We can't allow the type property to be changed (since it causes problems in IE)
if ( name == "type" && jQuery.nodeName( elem, "input" ) && elem.parentNode )
throw "type property can't be changed";
elem[ name ] = value;
}
// browsers index elements by id/name on forms, give priority to attributes.
if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) )
return elem.getAttributeNode( name ).nodeValue;
// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
if ( name == "tabIndex" ) {
var attributeNode = elem.getAttributeNode( "tabIndex" );
return attributeNode && attributeNode.specified
? attributeNode.value
: elem.nodeName.match(/(button|input|object|select|textarea)/i)
? 0
: elem.nodeName.match(/^(a|area)$/i) && elem.href
? 0
: undefined;
}
return elem[ name ];
}
if ( !jQuery.support.style && notxml && name == "style" )
return jQuery.attr( elem.style, "cssText", value );
if ( set )
// convert the value to a string (all browsers do this but IE) see #1070
elem.setAttribute( name, "" + value );
var attr = !jQuery.support.hrefNormalized && notxml && special
// Some attributes require a special call on IE
? elem.getAttribute( name, 2 )
: elem.getAttribute( name );
// Non-existent attributes return null, we normalize to undefined
return attr === null ? undefined : attr;
}
// elem is actually elem.style ... set the style
// IE uses filters for opacity
if ( !jQuery.support.opacity && name == "opacity" ) {
if ( set ) {
// IE has trouble with opacity if it does not have layout
// Force it by setting the zoom level
elem.zoom = 1;
// Set the alpha filter to set the opacity
elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) +
(parseInt( value ) + '' == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")");
}
return elem.filter && elem.filter.indexOf("opacity=") >= 0 ?
(parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100) + '':
"";
}
name = name.replace(/-([a-z])/ig, function(all, letter){
return letter.toUpperCase();
});
if ( set )
elem[ name ] = value;
return elem[ name ];
},
trim: function( text ) {
return (text || "").replace( /^\s+|\s+$/g, "" );
},
makeArray: function( array ) {
var ret = [];
if( array != null ){
var i = array.length;
// The window, strings (and functions) also have 'length'
if( i == null || typeof array === "string" || jQuery.isFunction(array) || array.setInterval )
ret[0] = array;
else
while( i )
ret[--i] = array[i];
}
return ret;
},
inArray: function( elem, array ) {
for ( var i = 0, length = array.length; i < length; i++ )
// Use === because on IE, window == document
if ( array[ i ] === elem )
return i;
return -1;
},
merge: function( first, second ) {
// We have to loop this way because IE & Opera overwrite the length
// expando of getElementsByTagName
var i = 0, elem, pos = first.length;
// Also, we need to make sure that the correct elements are being returned
// (IE returns comment nodes in a '*' query)
if ( !jQuery.support.getAll ) {
while ( (elem = second[ i++ ]) != null )
if ( elem.nodeType != 8 )
first[ pos++ ] = elem;
} else
while ( (elem = second[ i++ ]) != null )
first[ pos++ ] = elem;
return first;
},
unique: function( array ) {
var ret = [], done = {};
try {
for ( var i = 0, length = array.length; i < length; i++ ) {
var id = jQuery.data( array[ i ] );
if ( !done[ id ] ) {
done[ id ] = true;
ret.push( array[ i ] );
}
}
} catch( e ) {
ret = array;
}
return ret;
},
grep: function( elems, callback, inv ) {
var ret = [];
// Go through the array, only saving the items
// that pass the validator function
for ( var i = 0, length = elems.length; i < length; i++ )
if ( !inv != !callback( elems[ i ], i ) )
ret.push( elems[ i ] );
return ret;
},
map: function( elems, callback ) {
var ret = [];
// Go through the array, translating each of the items to their
// new value (or values).
for ( var i = 0, length = elems.length; i < length; i++ ) {
var value = callback( elems[ i ], i );
if ( value != null )
ret[ ret.length ] = value;
}
return ret.concat.apply( [], ret );
}
});
// Use of jQuery.browser is deprecated.
// It's included for backwards compatibility and plugins,
// although they should work to migrate away.
var userAgent = navigator.userAgent.toLowerCase();
// Figure out what browser is being used
jQuery.browser = {
version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1],
safari: /webkit/.test( userAgent ),
opera: /opera/.test( userAgent ),
msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
};
jQuery.each({
parent: function(elem){return elem.parentNode;},
parents: function(elem){return jQuery.dir(elem,"parentNode");},
next: function(elem){return jQuery.nth(elem,2,"nextSibling");},
prev: function(elem){return jQuery.nth(elem,2,"previousSibling");},
nextAll: function(elem){return jQuery.dir(elem,"nextSibling");},
prevAll: function(elem){return jQuery.dir(elem,"previousSibling");},
siblings: function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},
children: function(elem){return jQuery.sibling(elem.firstChild);},
contents: function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}
}, function(name, fn){
jQuery.fn[ name ] = function( selector ) {
var ret = jQuery.map( this, fn );
if ( selector && typeof selector == "string" )
ret = jQuery.multiFilter( selector, ret );
return this.pushStack( jQuery.unique( ret ), name, selector );
};
});
jQuery.each({
appendTo: "append",
prependTo: "prepend",
insertBefore: "before",
insertAfter: "after",
replaceAll: "replaceWith"
}, function(name, original){
jQuery.fn[ name ] = function( selector ) {
var ret = [], insert = jQuery( selector );
for ( var i = 0, l = insert.length; i < l; i++ ) {
var elems = (i > 0 ? this.clone(true) : this).get();
jQuery.fn[ original ].apply( jQuery(insert[i]), elems );
ret = ret.concat( elems );
}
return this.pushStack( ret, name, selector );
};
});
jQuery.each({
removeAttr: function( name ) {
jQuery.attr( this, name, "" );
if (this.nodeType == 1)
this.removeAttribute( name );
},
addClass: function( classNames ) {
jQuery.className.add( this, classNames );
},
removeClass: function( classNames ) {
jQuery.className.remove( this, classNames );
},
toggleClass: function( classNames, state ) {
if( typeof state !== "boolean" )
state = !jQuery.className.has( this, classNames );
jQuery.className[ state ? "add" : "remove" ]( this, classNames );
},
remove: function( selector ) {
if ( !selector || jQuery.filter( selector, [ this ] ).length ) {
// Prevent memory leaks
jQuery( "*", this ).add([this]).each(function(){
jQuery.event.remove(this);
jQuery.removeData(this);
});
if (this.parentNode)
this.parentNode.removeChild( this );
}
},
empty: function() {
// Remove element nodes and prevent memory leaks
jQuery(this).children().remove();
// Remove any remaining nodes
while ( this.firstChild )
this.removeChild( this.firstChild );
}
}, function(name, fn){
jQuery.fn[ name ] = function(){
return this.each( fn, arguments );
};
});
// Helper function used by the dimensions and offset modules
function num(elem, prop) {
return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0;
}
var expando = "jQuery" + now(), uuid = 0, windowData = {};
jQuery.extend({
cache: {},
data: function( elem, name, data ) {
elem = elem == window ?
windowData :
elem;
var id = elem[ expando ];
// Compute a unique ID for the element
if ( !id )
id = elem[ expando ] = ++uuid;
// Only generate the data cache if we're
// trying to access or manipulate it
if ( name && !jQuery.cache[ id ] )
jQuery.cache[ id ] = {};
// Prevent overriding the named cache with undefined values
if ( data !== undefined )
jQuery.cache[ id ][ name ] = data;
// Return the named cache data, or the ID for the element
return name ?
jQuery.cache[ id ][ name ] :
id;
},
removeData: function( elem, name ) {
elem = elem == window ?
windowData :
elem;
var id = elem[ expando ];
// If we want to remove a specific section of the element's data
if ( name ) {
if ( jQuery.cache[ id ] ) {
// Remove the section of cache data
delete jQuery.cache[ id ][ name ];
// If we've removed all the data, remove the element's cache
name = "";
for ( name in jQuery.cache[ id ] )
break;
if ( !name )
jQuery.removeData( elem );
}
// Otherwise, we want to remove all of the element's data
} else {
// Clean up the element expando
try {
delete elem[ expando ];
} catch(e){
// IE has trouble directly removing the expando
// but it's ok with using removeAttribute
if ( elem.removeAttribute )
elem.removeAttribute( expando );
}
// Completely remove the data cache
delete jQuery.cache[ id ];
}
},
queue: function( elem, type, data ) {
if ( elem ){
type = (type || "fx") + "queue";
var q = jQuery.data( elem, type );
if ( !q || jQuery.isArray(data) )
q = jQuery.data( elem, type, jQuery.makeArray(data) );
else if( data )
q.push( data );
}
return q;
},
dequeue: function( elem, type ){
var queue = jQuery.queue( elem, type ),
fn = queue.shift();
if( !type || type === "fx" )
fn = queue[0];
if( fn !== undefined )
fn.call(elem);
}
});
jQuery.fn.extend({
data: function( key, value ){
var parts = key.split(".");
parts[1] = parts[1] ? "." + parts[1] : "";
if ( value === undefined ) {
var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
if ( data === undefined && this.length )
data = jQuery.data( this[0], key );
return data === undefined && parts[1] ?
this.data( parts[0] ) :
data;
} else
return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){
jQuery.data( this, key, value );
});
},
removeData: function( key ){
return this.each(function(){
jQuery.removeData( this, key );
});
},
queue: function(type, data){
if ( typeof type !== "string" ) {
data = type;
type = "fx";
}
if ( data === undefined )
return jQuery.queue( this[0], type );
return this.each(function(){
var queue = jQuery.queue( this, type, data );
if( type == "fx" && queue.length == 1 )
queue[0].call(this);
});
},
dequeue: function(type){
return this.each(function(){
jQuery.dequeue( this, type );
});
}
});/*!
* Sizzle CSS Selector Engine - v0.9.3
* Copyright 2009, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
* More information: http://sizzlejs.com/
*/
(function(){
var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,
done = 0,
toString = Object.prototype.toString;
var Sizzle = function(selector, context, results, seed) {
results = results || [];
context = context || document;
if ( context.nodeType !== 1 && context.nodeType !== 9 )
return [];
if ( !selector || typeof selector !== "string" ) {
return results;
}
var parts = [], m, set, checkSet, check, mode, extra, prune = true;
// Reset the position of the chunker regexp (start from head)
chunker.lastIndex = 0;
while ( (m = chunker.exec(selector)) !== null ) {
parts.push( m[1] );
if ( m[2] ) {
extra = RegExp.rightContext;
break;
}
}
if ( parts.length > 1 && origPOS.exec( selector ) ) {
if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
set = posProcess( parts[0] + parts[1], context );
} else {
set = Expr.relative[ parts[0] ] ?
[ context ] :
Sizzle( parts.shift(), context );
while ( parts.length ) {
selector = parts.shift();
if ( Expr.relative[ selector ] )
selector += parts.shift();
set = posProcess( selector, set );
}
}
} else {
var ret = seed ?
{ expr: parts.pop(), set: makeArray(seed) } :
Sizzle.find( parts.pop(), parts.length === 1 && context.parentNode ? context.parentNode : context, isXML(context) );
set = Sizzle.filter( ret.expr, ret.set );
if ( parts.length > 0 ) {
checkSet = makeArray(set);
} else {
prune = false;
}
while ( parts.length ) {
var cur = parts.pop(), pop = cur;
if ( !Expr.relative[ cur ] ) {
cur = "";
} else {
pop = parts.pop();
}
if ( pop == null ) {
pop = context;
}
Expr.relative[ cur ]( checkSet, pop, isXML(context) );
}
}
if ( !checkSet ) {
checkSet = set;
}
if ( !checkSet ) {
throw "Syntax error, unrecognized expression: " + (cur || selector);
}
if ( toString.call(checkSet) === "[object Array]" ) {
if ( !prune ) {
results.push.apply( results, checkSet );
} else if ( context.nodeType === 1 ) {
for ( var i = 0; checkSet[i] != null; i++ ) {
if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) {
results.push( set[i] );
}
}
} else {
for ( var i = 0; checkSet[i] != null; i++ ) {
if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
results.push( set[i] );
}
}
}
} else {
makeArray( checkSet, results );
}
if ( extra ) {
Sizzle( extra, context, results, seed );
if ( sortOrder ) {
hasDuplicate = false;
results.sort(sortOrder);
if ( hasDuplicate ) {
for ( var i = 1; i < results.length; i++ ) {
if ( results[i] === results[i-1] ) {
results.splice(i--, 1);
}
}
}
}
}
return results;
};
Sizzle.matches = function(expr, set){
return Sizzle(expr, null, null, set);
};
Sizzle.find = function(expr, context, isXML){
var set, match;
if ( !expr ) {
return [];
}
for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
var type = Expr.order[i], match;
if ( (match = Expr.match[ type ].exec( expr )) ) {
var left = RegExp.leftContext;
if ( left.substr( left.length - 1 ) !== "\\" ) {
match[1] = (match[1] || "").replace(/\\/g, "");
set = Expr.find[ type ]( match, context, isXML );
if ( set != null ) {
expr = expr.replace( Expr.match[ type ], "" );
break;
}
}
}
}
if ( !set ) {
set = context.getElementsByTagName("*");
}
return {set: set, expr: expr};
};
Sizzle.filter = function(expr, set, inplace, not){
var old = expr, result = [], curLoop = set, match, anyFound,
isXMLFilter = set && set[0] && isXML(set[0]);
while ( expr && set.length ) {
for ( var type in Expr.filter ) {
if ( (match = Expr.match[ type ].exec( expr )) != null ) {
var filter = Expr.filter[ type ], found, item;
anyFound = false;
if ( curLoop == result ) {
result = [];
}
if ( Expr.preFilter[ type ] ) {
match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
if ( !match ) {
anyFound = found = true;
} else if ( match === true ) {
continue;
}
}
if ( match ) {
for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
if ( item ) {
found = filter( item, match, i, curLoop );
var pass = not ^ !!found;
if ( inplace && found != null ) {
if ( pass ) {
anyFound = true;
} else {
curLoop[i] = false;
}
} else if ( pass ) {
result.push( item );
anyFound = true;
}
}
}
}
if ( found !== undefined ) {
if ( !inplace ) {
curLoop = result;
}
expr = expr.replace( Expr.match[ type ], "" );
if ( !anyFound ) {
return [];
}
break;
}
}
}
// Improper expression
if ( expr == old ) {
if ( anyFound == null ) {
throw "Syntax error, unrecognized expression: " + expr;
} else {
break;
}
}
old = expr;
}
return curLoop;
};
var Expr = Sizzle.selectors = {
order: [ "ID", "NAME", "TAG" ],
match: {
ID: /#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,
CLASS: /\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,
NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,
ATTR: /\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
TAG: /^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,
CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,
POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,
PSEUDO: /:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/
},
attrMap: {
"class": "className",
"for": "htmlFor"
},
attrHandle: {
href: function(elem){
return elem.getAttribute("href");
}
},
relative: {
"+": function(checkSet, part, isXML){
var isPartStr = typeof part === "string",
isTag = isPartStr && !/\W/.test(part),
isPartStrNotTag = isPartStr && !isTag;
if ( isTag && !isXML ) {
part = part.toUpperCase();
}
for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
if ( (elem = checkSet[i]) ) {
while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
checkSet[i] = isPartStrNotTag || elem && elem.nodeName === part ?
elem || false :
elem === part;
}
}
if ( isPartStrNotTag ) {
Sizzle.filter( part, checkSet, true );
}
},
">": function(checkSet, part, isXML){
var isPartStr = typeof part === "string";
if ( isPartStr && !/\W/.test(part) ) {
part = isXML ? part : part.toUpperCase();
for ( var i = 0, l = checkSet.length; i < l; i++ ) {
var elem = checkSet[i];
if ( elem ) {
var parent = elem.parentNode;
checkSet[i] = parent.nodeName === part ? parent : false;
}
}
} else {
for ( var i = 0, l = checkSet.length; i < l; i++ ) {
var elem = checkSet[i];
if ( elem ) {
checkSet[i] = isPartStr ?
elem.parentNode :
elem.parentNode === part;
}
}
if ( isPartStr ) {
Sizzle.filter( part, checkSet, true );
}
}
},
"": function(checkSet, part, isXML){
var doneName = done++, checkFn = dirCheck;
if ( !part.match(/\W/) ) {
var nodeCheck = part = isXML ? part : part.toUpperCase();
checkFn = dirNodeCheck;
}
checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML);
},
"~": function(checkSet, part, isXML){
var doneName = done++, checkFn = dirCheck;
if ( typeof part === "string" && !part.match(/\W/) ) {
var nodeCheck = part = isXML ? part : part.toUpperCase();
checkFn = dirNodeCheck;
}
checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML);
}
},
find: {
ID: function(match, context, isXML){
if ( typeof context.getElementById !== "undefined" && !isXML ) {
var m = context.getElementById(match[1]);
return m ? [m] : [];
}
},
NAME: function(match, context, isXML){
if ( typeof context.getElementsByName !== "undefined" ) {
var ret = [], results = context.getElementsByName(match[1]);
for ( var i = 0, l = results.length; i < l; i++ ) {
if ( results[i].getAttribute("name") === match[1] ) {
ret.push( results[i] );
}
}
return ret.length === 0 ? null : ret;
}
},
TAG: function(match, context){
return context.getElementsByTagName(match[1]);
}
},
preFilter: {
CLASS: function(match, curLoop, inplace, result, not, isXML){
match = " " + match[1].replace(/\\/g, "") + " ";
if ( isXML ) {
return match;
}
for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
if ( elem ) {
if ( not ^ (elem.className && (" " + elem.className + " ").indexOf(match) >= 0) ) {
if ( !inplace )
result.push( elem );
} else if ( inplace ) {
curLoop[i] = false;
}
}
}
return false;
},
ID: function(match){
return match[1].replace(/\\/g, "");
},
TAG: function(match, curLoop){
for ( var i = 0; curLoop[i] === false; i++ ){}
return curLoop[i] && isXML(curLoop[i]) ? match[1] : match[1].toUpperCase();
},
CHILD: function(match){
if ( match[1] == "nth" ) {
// parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
match[2] == "even" && "2n" || match[2] == "odd" && "2n+1" ||
!/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
// calculate the numbers (first)n+(last) including if they are negative
match[2] = (test[1] + (test[2] || 1)) - 0;
match[3] = test[3] - 0;
}
// TODO: Move to normal caching system
match[0] = done++;
return match;
},
ATTR: function(match, curLoop, inplace, result, not, isXML){
var name = match[1].replace(/\\/g, "");
if ( !isXML && Expr.attrMap[name] ) {
match[1] = Expr.attrMap[name];
}
if ( match[2] === "~=" ) {
match[4] = " " + match[4] + " ";
}
return match;
},
PSEUDO: function(match, curLoop, inplace, result, not){
if ( match[1] === "not" ) {
// If we're dealing with a complex expression, or a simple one
if ( match[3].match(chunker).length > 1 || /^\w/.test(match[3]) ) {
match[3] = Sizzle(match[3], null, null, curLoop);
} else {
var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
if ( !inplace ) {
result.push.apply( result, ret );
}
return false;
}
} else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
return true;
}
return match;
},
POS: function(match){
match.unshift( true );
return match;
}
},
filters: {
enabled: function(elem){
return elem.disabled === false && elem.type !== "hidden";
},
disabled: function(elem){
return elem.disabled === true;
},
checked: function(elem){
return elem.checked === true;
},
selected: function(elem){
// Accessing this property makes selected-by-default
// options in Safari work properly
elem.parentNode.selectedIndex;
return elem.selected === true;
},
parent: function(elem){
return !!elem.firstChild;
},
empty: function(elem){
return !elem.firstChild;
},
has: function(elem, i, match){
return !!Sizzle( match[3], elem ).length;
},
header: function(elem){
return /h\d/i.test( elem.nodeName );
},
text: function(elem){
return "text" === elem.type;
},
radio: function(elem){
return "radio" === elem.type;
},
checkbox: function(elem){
return "checkbox" === elem.type;
},
file: function(elem){
return "file" === elem.type;
},
password: function(elem){
return "password" === elem.type;
},
submit: function(elem){
return "submit" === elem.type;
},
image: function(elem)
Untitled JavaScript (16-Jul @ 10:31)
Syntax Highlighted Code
- <script type="text/javascript">
- $(document).ready(function(){
- $("#pulicaId").change(function(){
- var pulicaVal = $("#pulicaId").val();
- [7 more lines...]
Plain Code
<script type="text/javascript">
$(document).ready(function(){
$("#pulicaId").change(function(){
var pulicaVal = $("#pulicaId").val();
alert(pulicaVal);
});
});
</script>
<select name="pulica" id="pulicaId">
<option value="3">Optiune 1</option>
</select>
Untitled JavaScript (14-Jul @ 11:58)
Syntax Highlighted Code
- $('.gallery-lister img').click(function(){
- $('.gallery-lister img').animate({opacity: 1});
- $(this).animate({opacity: 0.5});
- $('.bigphotopopup').show('fast');
- [8 more lines...]
Plain Code
$('.gallery-lister img').click(function(){
$('.gallery-lister img').animate({opacity: 1});
$(this).animate({opacity: 0.5});
$('.bigphotopopup').show('fast');
var path = $(this).parent().attr('href');
var text = $('p',$(this).parent());
$('.bppContent').animate({opacity: 0},500,function(){
$(this).html('<img src=' + path + ' />').find('img').bind('load',function(){
$(this).parent().append(text.clone()).animate({opacity: 1},500);
});
});
return false;
});
Untitled JavaScript (29-Jun @ 20:52)
Syntax Highlighted Code
- var horizontalPositions = /left|center|right/,
- horizontalDefault = 'center',
- verticalPositions = /top|middle|bottom/,
- verticalDefault = 'middle';
- [90 more lines...]
Plain Code
var horizontalPositions = /left|center|right/,
horizontalDefault = 'center',
verticalPositions = /top|middle|bottom/,
verticalDefault = 'middle';
$.fn.positionTo = function(options) {
options = $.extend({
collisionDetect: 'flip',
stackFix: true
}, options);
var target = $(options.of),
targetProps = {
offset: target.offset(),
width: target.outerWidth(),
height: target.outerHeight()
},
offset = options.offset.replace(/px/gi, '').split(' '),
position = targetProps.offset;
$.each(['my', 'at'], function() {
var pos = options[this].split(' ');
pos = pos.length == 1
? horizontalPositions.test(pos[0])
? pos.concat([verticalDefault])
: verticalPositions.test(pos[0])
? [horizontalDefault].concat(pos)
: [horizontalDefault, verticalDefault]
: pos;
pos[0] = horizontalPositions.test(pos[0]) ? pos[0] : horizontalDefault;
pos[1] = verticalPositions.test(pos[1]) ? pos[1] : verticalDefault;
options[this] = pos;
});
switch (options.at[0]) {
case 'left':
break;
case 'right':
position.left += targetProps.width;
break;
default:
position.left += targetProps.width / 2;
break;
}
switch (options.at[1]) {
case 'top':
break;
case 'bottom':
position.left += targetProps.height;
break;
default:
position.left += targetProps.height / 2;
break;
}
return this.each(function() {
var elem = $(this),
elemProps = {
width: elem.outerWidth(),
height: elem.outerHeight()
};
switch (options.my[0]) {
case 'left':
break;
case 'right':
position.left -= elemProps.width;
break;
default:
position.left -= elemProps.width / 2;
break;
}
switch (options.my[1]) {
case 'top':
break;
case 'bottom':
position.left -= elemProps.height;
break;
default:
position.left -= elemProps.height / 2;
break;
}
// TODO: offset option
// TODO: collision option
// TODO: by option
// TODO: stackfix option
console.log(position);
elem.offset(position);
});
};
Untitled JavaScript (19-Jun @ 08:17)
Syntax Highlighted Code
- switch(obj.options[obj.selectedIndex].value){
- case 'wmz':
- how.value = 'Z';
- [156 more lines...]
Plain Code
switch(obj.options[obj.selectedIndex].value){
case 'wmz':
how.value = 'Z';
how.style.display = 'block';
how.style.position = 'static';
how2.style.display = 'none';
how2.style.position = 'absolute';
how3.style.display = 'none';
how3.style.position = 'absolute';
numberPayFirstDesc.innerHTML = 'ÐÐ¾Ð¼ÐµÑ WMZ коÑелÑка';
numberPayFirstDesc.style.display = 'block';
numberPayFirstDesc.style.position = 'static';
numberPaySecondDesc.style.display = 'none';
numberPaySecondDesc.style.position = 'absolute';
numberPayThirdDesc.style.display = 'none';
numberPayThirdDesc.style.position = 'absolute';
break;
case 'wmu':
how.value = 'U';
how.style.display = 'block';
how.style.position = 'static';
how2.style.display = 'none';
how2.style.position = 'absolute';
how3.style.display = 'none';
how3.style.position = 'absolute';
numberPayFirstDesc.innerHTML = 'ÐÐ¾Ð¼ÐµÑ WMU коÑелÑка';
numberPayFirstDesc.style.display = 'block';
numberPayFirstDesc.style.position = 'static';
numberPaySecondDesc.style.display = 'none';
numberPaySecondDesc.style.position = 'absolute';
numberPayThirdDesc.style.display = 'none';
numberPayThirdDesc.style.position = 'absolute';
break;
case 'wmr':
how.value = 'R';
how.style.display = 'block';
how.style.position = 'static';
how2.style.display = 'none';
how2.style.position = 'absolute';
how3.style.display = 'none';
how3.style.position = 'absolute';
numberPayFirstDesc.innerHTML = 'ÐÐ¾Ð¼ÐµÑ WMR коÑелÑка';
numberPayFirstDesc.style.display = 'block';
numberPayFirstDesc.style.position = 'static';
numberPaySecondDesc.style.display = 'none';
numberPaySecondDesc.style.position = 'absolute';
numberPayThirdDesc.style.display = 'none';
numberPayThirdDesc.style.position = 'absolute';
break;
case 'wme':
how.value = 'E';
how.style.display = 'block';
how.style.position = 'static';
how2.style.display = 'none';
how2.style.position = 'absolute';
how3.style.display = 'none';
how3.style.position = 'absolute';
numberPayFirstDesc.innerHTML = 'ÐÐ¾Ð¼ÐµÑ WME коÑелÑка';
numberPayFirstDesc.style.display = 'block';
numberPayFirstDesc.style.position = 'static';
numberPaySecondDesc.style.display = 'none';
numberPaySecondDesc.style.position = 'absolute';
numberPayThirdDesc.style.display = 'none';
numberPayThirdDesc.style.position = 'absolute';
break;
case 'yandex':
how.style.display = 'block';
how.style.position = 'static';
how2.style.display = 'none';
how2.style.position = 'absolute';
how3.style.display = 'none';
how3.style.position = 'absolute';
numberPayFirstDesc.innerHTML = 'ÐÐ¾Ð¼ÐµÑ Ð¯Ð½Ð´ÐµÐºÑ ÐºÐ¾ÑелÑка';
numberPayFirstDesc.style.display = 'block';
numberPayFirstDesc.style.position = 'static';
numberPaySecondDesc.style.display = 'none';
numberPaySecondDesc.style.position = 'absolute';
numberPayThirdDesc.style.display = 'none';
numberPayThirdDesc.style.position = 'absolute';
break;
case 'bank':
how.style.display = 'block';
how.style.position = 'static';
how2.style.display = 'block';
how2.style.position = 'static';
how3.style.display = 'none';
how3.style.position = 'absolute';
numberPayFirstDesc.innerHTML = 'Ðазвание банка';
numberPayFirstDesc.style.display = 'block';
numberPayFirstDesc.style.position = 'static';
numberPaySecondDesc.innerHTML = 'ÐÐ¾Ð¼ÐµÑ ÑÑеÑа';
numberPaySecondDesc.style.display = 'block';
numberPaySecondDesc.style.position = 'static';
numberPayThirdDesc.style.display = 'none';
numberPayThirdDesc.style.position = 'absolute';
break;
case 'user':
how.style.display = 'block';
how.style.position = 'static';
how2.style.display = 'block';
how2.style.position = 'static';
how3.style.display = 'block';
how3.style.position = 'static';
numberPayFirstDesc.innerHTML = 'Ðогин полÑзоваÑелÑ';
numberPayFirstDesc.style.display = 'block';
numberPayFirstDesc.style.position = 'static';
numberPaySecondDesc.innerHTML = 'или ID полÑзоваÑелÑ';
numberPaySecondDesc.style.display = 'block';
numberPaySecondDesc.style.position = 'static';
numberPayThirdDesc.innerHTML = 'СÑма пеÑевода';
numberPayThirdDesc.style.display = 'block';
numberPayThirdDesc.style.position = 'static';
break;
default:
numberPayFirstDesc.innerHTML = '';
numberPayFirstDesc.style.display = 'none';
numberPayFirstDesc.style.position = 'absolute';
numberPaySecondDesc.innerHTML = '';
numberPaySecondDesc.style.display = 'none';
numberPaySecondDesc.style.position = 'absolute';
numberPayThirdDesc.innerHTML = '';
numberPayThirdDesc.style.display = 'none';
numberPayThirdDesc.style.position = 'absolute';
how.style.display = 'none';
how.style.position = 'absolute';
how2.style.display = 'none';
how2.style.position = 'absolute';
how3.style.display = 'none';
how3.style.position = 'absolute';
}
}
Hello World (16-Jun @ 23:19)
Syntax Highlighted Code
- function HelloWorld() {
- alert("Hello world!");
- }
Plain Code
function HelloWorld() {
alert("Hello world!");
}
Untitled JavaScript (15-Jun @ 15:51)
Syntax Highlighted Code
- switch(obj.options[obj.selectedIndex].value){
- case 'wmz':
- how.value = 'Z';
- [155 more lines...]
Plain Code
switch(obj.options[obj.selectedIndex].value){
case 'wmz':
how.value = 'Z';
how.style.display = 'block';
how.style.position = 'static';
how2.style.display = 'none';
how2.style.position = 'absolute';
how3.style.display = 'none';
how3.style.position = 'absolute';
numberPayFirstDesc.innerHTML = 'ÐÐ¾Ð¼ÐµÑ WMZ коÑелÑка';
numberPayFirstDesc.style.display = 'block';
numberPayFirstDesc.style.position = 'static';
numberPaySecondDesc.style.display = 'none';
numberPaySecondDesc.style.position = 'absolute';
numberPayThirdDesc.style.display = 'none';
numberPayThirdDesc.style.position = 'absolute';
break;
case 'wmu':
how.value = 'U';
how.style.display = 'block';
how.style.position = 'static';
how2.style.display = 'none';
how2.style.position = 'absolute';
how3.style.display = 'none';
how3.style.position = 'absolute';
numberPayFirstDesc.innerHTML = 'ÐÐ¾Ð¼ÐµÑ WMU коÑелÑка';
numberPayFirstDesc.style.display = 'block';
numberPayFirstDesc.style.position = 'static';
numberPaySecondDesc.style.display = 'none';
numberPaySecondDesc.style.position = 'absolute';
numberPayThirdDesc.style.display = 'none';
numberPayThirdDesc.style.position = 'absolute';
break;
case 'wmr':
how.value = 'R';
how.style.display = 'block';
how.style.position = 'static';
how2.style.display = 'none';
how2.style.position = 'absolute';
how3.style.display = 'none';
how3.style.position = 'absolute';
numberPayFirstDesc.innerHTML = 'ÐÐ¾Ð¼ÐµÑ WMR коÑелÑка';
numberPayFirstDesc.style.display = 'block';
numberPayFirstDesc.style.position = 'static';
numberPaySecondDesc.style.display = 'none';
numberPaySecondDesc.style.position = 'absolute';
numberPayThirdDesc.style.display = 'none';
numberPayThirdDesc.style.position = 'absolute';
break;
case 'wme':
how.value = 'E';
how.style.display = 'block';
how.style.position = 'static';
how2.style.display = 'none';
how2.style.position = 'absolute';
how3.style.display = 'none';
how3.style.position = 'absolute';
numberPayFirstDesc.innerHTML = 'ÐÐ¾Ð¼ÐµÑ WME коÑелÑка';
numberPayFirstDesc.style.display = 'block';
numberPayFirstDesc.style.position = 'static';
numberPaySecondDesc.style.display = 'none';
numberPaySecondDesc.style.position = 'absolute';
numberPayThirdDesc.style.display = 'none';
numberPayThirdDesc.style.position = 'absolute';
break;
case 'yandex':
how.style.display = 'block';
how.style.position = 'static';
how2.style.display = 'none';
how2.style.position = 'absolute';
how3.style.display = 'none';
how3.style.position = 'absolute';
numberPayFirstDesc.innerHTML = 'ÐÐ¾Ð¼ÐµÑ Ð¯Ð½Ð´ÐµÐºÑ ÐºÐ¾ÑелÑка';
numberPayFirstDesc.style.display = 'block';
numberPayFirstDesc.style.position = 'static';
numberPaySecondDesc.style.display = 'none';
numberPaySecondDesc.style.position = 'absolute';
numberPayThirdDesc.style.display = 'none';
numberPayThirdDesc.style.position = 'absolute';
break;
case 'bank':
how.style.display = 'block';
how.style.position = 'static';
how2.style.display = 'block';
how2.style.position = 'static';
how3.style.display = 'none';
how3.style.position = 'absolute';
numberPayFirstDesc.innerHTML = 'Ðазвание банка';
numberPayFirstDesc.style.display = 'block';
numberPayFirstDesc.style.position = 'static';
numberPaySecondDesc.innerHTML = 'ÐÐ¾Ð¼ÐµÑ ÑÑеÑа';
numberPaySecondDesc.style.display = 'block';
numberPaySecondDesc.style.position = 'static';
numberPayThirdDesc.style.display = 'none';
numberPayThirdDesc.style.position = 'absolute';
break;
case 'user':
how.style.display = 'block';
how.style.position = 'static';
how2.style.display = 'block';
how2.style.position = 'static';
how3.style.display = 'block';
how3.style.position = 'static';
numberPayFirstDesc.innerHTML = 'Ðогин полÑзоваÑелÑ';
numberPayFirstDesc.style.display = 'block';
numberPayFirstDesc.style.position = 'static';
numberPaySecondDesc.innerHTML = 'или ID полÑзоваÑелÑ';
numberPaySecondDesc.style.display = 'block';
numberPaySecondDesc.style.position = 'static';
numberPayThirdDesc.innerHTML = 'СÑма пеÑевода';
numberPayThirdDesc.style.display = 'block';
numberPayThirdDesc.style.position = 'static';
break;
default:
numberPayFirstDesc.innerHTML = '';
numberPayFirstDesc.style.display = 'none';
numberPayFirstDesc.style.position = 'absolute';
numberPaySecondDesc.innerHTML = '';
numberPaySecondDesc.style.display = 'none';
numberPaySecondDesc.style.position = 'absolute';
numberPayThirdDesc.innerHTML = '';
numberPayThirdDesc.style.display = 'none';
numberPayThirdDesc.style.position = 'absolute';
how.style.display = 'none';
how.style.position = 'absolute';
how2.style.display = 'none';
how2.style.position = 'absolute';
how3.style.display = 'none';
how3.style.position = 'absolute';
}
Untitled JavaScript (5-Jun @ 15:31)
Syntax Highlighted Code
- jQuery(document).ready(function(){
- jQuery("#trimiteresms").submit(function(){
- var mail1 = jQuery("#mail1").val();
- var mail2 = jQuery("#mail2").val();
- [11 more lines...]
Plain Code
jQuery(document).ready(function(){
jQuery("#trimiteresms").submit(function(){
var mail1 = jQuery("#mail1").val();
var mail2 = jQuery("#mail2").val();
var mail3 = jQuery("#mail3").val();
var mail4 = jQuery("#mail4").val();
jQuery.get("nexus/_sms.php",{mode: "sendEmail",mail1: mail1, mail2: mail2, mail3: mail3, mail4: mail4},function(data){
jQuery("#confirmMail").html(data);
jQuery("#confirmMail").slideDown();
});
return false;
});
});
Untitled JavaScript (28-May @ 17:22)
Syntax Highlighted Code
- /*
- CONNECTION DIAGRAM
- [547 more lines...]
Plain Code
/*
CONNECTION DIAGRAM
------
PB0 -|1 40|- PA0
PB1 -|2 39|- PA1
PB2 -|3 28|- PA2
PB3 -|4 37|- PA3
PB4 -|5 36|- PA4
PB5 -|6 35|- PA5
PB6 -|7 34|- PA6
PB7 -|8 33|- PA7
RESET -|9 32|- AREF
VCC -|10 31|- GND
GND -|11 30|- AVCC
XTAL2 -|12 29|- PC7 UCNT1
XTAL1 -|13 28|- PC6 UCNT2
PD0 -|14 27|- PC5 UCNT3
USARTTX PD1 -|15 26|- PC4 LVL1
APOLLOEN PD2 -|16 25|- PC3 LVL2
MDIR PD3 -|17 24|- PC2 LVL3
MSEL0 PD4 -|18 23|- PC1 LVL4
MSEL1 PD5 -|19 22|- PC0
PWMOUT PD6 -|20 21|- PD7 HERMESEN
------
*/
#include <avr/io.h>
#include <util/delay.h>
#include <stdio.h>
#include <inttypes.h>
#define BAUD 9600
#define MYUBRR F_CPU/16/BAUD-1
#define RAMPTIME 3000 // PWM ramping time (ms)
#define RAMPINTERVAL 300 // PWM ramping interval (ms)
#define LVL4 PC1 // Nivåbryter nivå 4
#define LVL3 PC2 // Nivåbryter nivå 3
#define LVL2 PC3 // Nivåbryter nivå 2
#define LVL1 PC4 // Nivåbryter nivå 1
#define UCNT3 PC5 // Enhetsteller nivå 3
#define UCNT2 PC6 // Enhetsteller nivå 2
#define UCNT1 PC7 // Enhetsteller nivå 1
#define SENSINPUTPIN PINC // Porten sensorene er koblet til
#define SENSDDR DDRC // Dataretningsregister for sensorer
#define TEMP0 1 // Temperaturkanal 1
#define TEMP1 2 // Temperaturkanal 2
#define TEMP2 3 // Temperaturkanal 3
#define TEMP3 4 // Temperaturkanal 4
#define DOOR1 PA5 // Dørbryter 1
#define DOOR2 PA6 // Dørbryter 2
#define DOOR3 PA7 // Dørbryter 3
#define DOORPIN PINA // Porten dørbryterne er koblet til
#define HERMESEN PD7 // Hermes enable
#define APOLLOEN PD2 // Apollo enable
#define UCPORT PORTD // Porten enable-utgangene er på
#define MDIR PD3 // Motor direction
#define MSEL0 PD4 // Motor selection bit0
#define MSEL1 PD5 // Motor selection bit1
#define PWMOUT PD6 // Motor PWM channel
#define MOTORPORT PORTD // Porten motordriveren er koblet til
#define MOTORDDR DDRD // Dataretningsregister for motorport
#define HOME 4
#define HIS PA0 // Aktiveringsbryter for bordet
#define HISPIN PINA // Porten aktiveringsbryteren står på
#define EMPTY 0
#define FORWARD 1
#define REVERSE 0
#define UP 1
#define DOWN 0
#define BOUNCELIMIT 30 // Avprelleingsteller grenseverdi
int sensecnt = 0; // Avprellingsteller
int holdflag=0; // Hold-flagg for avprelling
int lvlcnt1 = 1; // Enhetsteller for nivå 1
int lvlcnt2 = 1; // Enhetsteller for nivå 2
int lvlcnt3 = 1; // Enhetsteller for nivå 3
int curtemp0 = 1023; // Temperaturvariabel for nivå 1
int curtemp1 = 1023; // Temperaturvariabel for nivå 2
int curtemp2 = 1023; // Temperaturvariabel for nivå 3
int curtemp3 = 1023; // Temperaturvariabel for nivå 4
int picklvl = EMPTY;
int motor = 1;
int motordir = FORWARD;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/*
Les inn verdi fra ADC-omforming
@param int chan - Hvilken ADC-kanal det skal leses fra.
*/
int readADC (int chan){
int i;
int ADC_temp;
int ADCx = 0;
ADMUX = chan; // Velg kanal
ADMUX |= (1 << REFS0); // Sett referanse til AVCC med ekstern kodensator på AREF
ADMUX &= ~(1<<REFS1);
ADCSRA |= (1<<ADPS2)|(1<<ADPS0); // Sett /16 presacling
ADCSRA |= (1<<ADEN); // Aktiver ADCen
for(i=0;i<8;i++) { // Kjør 8 omforminger av signalet, og bruk gjennomsnittet
ADCSRA |= (1<<ADSC); // Kjør en enkel omforming
while(!(ADCSRA & 0x10)); // Vent til omformingen er ferdig. (ADIF-flagget settes)
ADC_temp = ADCL; // Les nedre del av SAR-registeret
ADC_temp += (ADCH<<8); // Legg til øvre del av SAR-registert. (Dette må skiftes 8 plasser)
ADCx += ADC_temp; // Akkumuler verdien
}
ADCx = (ADCx>>3); // Del på 8 (Finn gjennomsnittsverdien)
ADCSRA &= ~(1<<ADEN); // Deaktiver ADCen
return ADCx; // Returner ADC-verdien
}
/*
USART Initialiseringsrutine
@param unsigned int baud - Overføringshastigheten
*/
void USARTInit( unsigned int baud ){
UBRR0H = (unsigned char) (baud>>8); // Sett overføringshastigheten
UBRR0L = (unsigned char) baud;
UCSR0B = (1<< TXEN0); // Aktiver USART-sendemodul
UCSR0C = (1<<USBS0)|(1<<UCSZ01)|(1<<UCSZ00);// Sett rammeformat til: 1 start-, 8 data- og 2 stoppbit
}
/*
USART Sending av ett tegn
@param unsigned char data - Tegnet som skal sendes
*/
void USARTTransmitByte( unsigned char data ){
while (!(UCSR0A & (1<<UDRE0))); // Vent til USART-modulen er klar for sending
UDR0 = data; // Start overføringen
}
/*
USART Sending av tekststreng
@param const char *str - Peker til hvilken streng som skal sendes
*/
void USARTTransmit(const char *str){
while(*str) {
USARTTransmitByte((unsigned char)(*str));
str++;
}
USARTTransmitByte(0x04); // Send stopp-byte (EOT)
}
/*
USART Initialiseringsrutine
*/
void PWMInit(void){
// Setter COM0A1 = 1, COM0A0 = 0 i TCCR0A => Clear OC0A on Compare Match, SET OC0A at BOTTOM (Non-Inverting mode)
// Setter WGM01 = 1, WGM00 = 1 i TCCR0A, og WGM02 = 0 i TCCR0B => Fast-PWM mode
TCCR2A |= (0<<COM2B1) | (0<<COM2B0)| (1<<WGM21) | (1<<WGM20);
TCCR2B &= ~(1<<WGM22);
TCCR2B |= (1<<CS20); // Ingen skalering av PWM-frekvensen
// Sett dataretning på de benyttede pinnene til ut.
MOTORDDR |= (1<<PWMOUT) | (1<<MSEL1) | (1<<MSEL0) | (1<<MDIR);
}
/*
Acpreller en puls fra en sensor/bryter
@param unsigned int sens - Referanse til hvilken sensor som skal avprelles
@param volatile uint8_t *port - Referanse til hvilken port sensoren er koblet på
*/
int debounce_pulse(unsigned int sens, volatile uint8_t *port){
int returnvar = 0;
while(*port & (1<<sens)){
sensecnt++;
if(sensecnt >= BOUNCELIMIT){
returnvar = 1;
}
}
sensecnt=0;
return returnvar;
}
/*
Avpreller en sensor/bryter som holdes inne
@param unsigned int sens - Referanse til hvilken sensor som skal avprelles
@param volatile uint8_t *port - Referanse til hvilken port sensoren er koblet på
*/
int debounce_hold(unsigned int sens, volatile uint8_t *pin) {
int returnvar = 0;
if(holdflag){
if(!(*pin & (1<<sens))){
holdflag=0;
}
} else {
if(*pin & (1<<sens)){
_delay_us(500);
if(*pin & (1<<sens)){
returnvar = 1;
holdflag=1;
}
}
}
return returnvar;
}
/*
Lagrer temperaturer i "nåværende temperatur"-variabler
*/
void readtemps(){
curtemp0 = readADC(TEMP0);
curtemp1 = readADC(TEMP1);
curtemp2 = readADC(TEMP3);
curtemp3 = readADC(TEMP3);
}
/*
Finner kaldeste nivå
@returns int - Returnerer en referanse til det kaldeste nivået
*/
int getcoldestlevel(){
int min = 1023;
int coldest = 1;
if(curtemp1 < min && lvlcnt1 > 0){
coldest = 1;
min = curtemp1;
}
if(curtemp2 < min && lvlcnt2 > 0){
coldest = 2;
min = curtemp2;
}
if(curtemp3 < min && lvlcnt3 > 0){
coldest = 3;
min = curtemp3;
}
return coldest;
}
/*
Initialisering av dataretningsregisteret for sensorene
*/
void SensorInit(){
SENSDDR = 0x01; // Sett alle pinner på port C til innganger.
}
/*
Sender systemstatus til Hermes via USART
*/
void SerialSendStatus(){
char usarttext[40];
int n;
readtemps();
n=sprintf(usarttext,"T1%dT2%dT3%dC1%dC2%dC3%d", curtemp1, curtemp2, curtemp3, lvlcnt1, lvlcnt2, lvlcnt3);
USARTTransmit(usarttext);
}
/*
Initialisering av motor
@param unsigned int motor - Hvilken motor som skal kjøres
@param unsigned in direction - Hvilken retning motoren skal rotere i
*/
void motor_init(unsigned int motor, unsigned int direction){
// Velg motor
if(motor == 0){
MOTORPORT &= ~(1<<MSEL0); // 0
MOTORPORT &= ~(1<<MSEL1); // 0
} else if (motor == 1){
MOTORPORT |= (1<<MSEL0); // 1
MOTORPORT &= ~(1<<MSEL1); // 0
} else if (motor == 2){
MOTORPORT &= ~(1<<MSEL0); // 0
MOTORPORT |= (1<<MSEL1); // 1
} else if (motor == 3){
MOTORPORT |= (1<<MSEL0); // 1
MOTORPORT |= (1<<MSEL1); // 1
}
if(direction){ // Sett retningen motoren skal kjøre
MOTORPORT |= (1<<MDIR);
} else {
MOTORPORT &= ~(1<<MDIR);
}
}
/*
Setter hastigheten (pådraget) til motorene
@param unsigned int speed - Hastigheten i prosent av fullt pådrag
*/
void motor_setspeed(unsigned int speed){
OCR2B = (255*speed)/100;
}
/*
Start motoren
*/
void motor_start(){
TCCR2A |= (1<<COM2B1);
}
/*
Stopp motoren
*/
void motor_stop(){
TCCR2A &= ~(1<<COM2B1);
}
/*
Ãker pÃ¥draget til motorene gradvis (sÃ¥kalt ramping)
*/
void motor_rampup(){
//int i = 1;
for(int i = 1;i<=100;i++){
_delay_ms(10);
motor_setspeed((255*i)/100); // Kalkuler pådragsverdi fra prosentverdi.
}
}
/*
Reduserer pådraget til motorene gradvis (såkalt ramping)
*/
void motor_rampdown(){
for(int i = 100;i>=1;i--){
_delay_ms(10);
motor_setspeed((255*i)/100); // Kalkuler pådragsverdi fra prosentverdi.
}
}
/*
Kjør heisen til ønsket nivå
@param unsigned int level - Hvilket nivå heisen skal kjøre til
*/
void elevator_goto(unsigned int level){
unsigned int dir;
if(level < HOME){
dir = DOWN;
} else {
dir = UP;
}
motor_init(level, dir);
motor_setspeed(60);
motor_start();
while(1){
if(level == 1){
if(debounce_hold(LVL1, &SENSINPUTPIN)){
break;
}
} else if (level == 2){
if(debounce_hold(LVL2, &SENSINPUTPIN)){
break;
}
} else if (level == 3){
if(debounce_hold(LVL3, &SENSINPUTPIN)){
break;
}
} else if (level == HOME){
if(debounce_hold(LVL3, &SENSINPUTPIN)){
break;
}
}
}
motor_stop();
}
/*
Roter et gitt nivå
@param unsigned int level - Hvilket nivå som skal roteres
@param unsigned int direction - Hvilken retnings skal nivået roteres i
@param unsigned int duration - Hvor lenge skal nivået rotere. (0 for uendelig).
*/
void rotatelevel(unsigned int level, unsigned int direction, unsigned int duration){
// Initialiser motoren med riktige verdier
motor_init(level, direction);
motor_setspeed(0); // Start motoren med 0 i pådrag
motor_start();
// Gradvis økning av pådrag (ramping) i 100*10ms = 1 sekund
motor_rampup();
// Motoren kjører nå på fullt pådrag
if(duration > 0){
_delay_ms(duration);
// Gradvis redusering av pådrag i 1 sekund
motor_rampdown();
motor_setspeed(0);
motor_stop();
}
}
/*
Starter dispenseringen av en enhet
@param unsigned int level - Hvilket nivå det skal hentes en enhet fra
*/
void dispenseunit(unsigned int level){
elevator_goto(level);
UCPORT |= (1<<APOLLOEN); // Aktiver Apollo (Lyseffekter)
rotatelevel(level, FORWARD, 5000);
elevator_goto(HOME);
UCPORT &= ~(1<<APOLLOEN); // Deaktiver Apollo (Lyseffekter)
}
/*
Starter påfyllingsmodus for et gitt nivå
@param unsigned int level - Hvilket nivå skal gå i påfyllingsmodus
@param unsigned int sens - Hvilken sensor/bryter som skal avbryte påfyllingen
@param volatile uint8_t *port - Hvilken port sensoren/bryteren er koblet til
*/
void startrefillmode(unsigned int level, unsigned int sens, volatile uint8_t *port){
rotatelevel(level, FORWARD, 0); // Roter nivået kontinuerlig
int count = 0;
while(debounce_hold(sens, port)){
// Ãk antallet enheter i hvertnivÃ¥ nÃ¥r en enhet blir satt inn
if(level == 1){
if(debounce_pulse(UCNT1, &SENSINPUTPIN)){
lvlcnt1++;
count = 1;
}
} else if(level == 2){
if(debounce_pulse(UCNT2, &SENSINPUTPIN)){
lvlcnt2++;
count = 1;
}
} else if(level == 3){
if(debounce_pulse(UCNT3, &SENSINPUTPIN)){
lvlcnt3++;
count = 1;
}
}
// Dersom en enhetsteller har økt, gi beskjed til Hermes.
if(count){
SerialSendStatus();
count = 0;
}
}
// Stopp rotasjonen av platået når døren lukkes
motor_rampdown();
motor_setspeed(0);
motor_stop();
}
/*
HÃ¥ndtering av sensorer
*/
void handle_sensors(){
if(debounce_hold(DOOR1, &DOORPIN)){ // Dersom dør 1 er åpnet...
startrefillmode(1, DOOR1, &DOORPIN); // ... start påfyllingsmodus i nivå 1
}
if(debounce_hold(DOOR2, &DOORPIN)){ // Dersom dør 1 er åpnet...
startrefillmode(2, DOOR2, &DOORPIN); // ... start påfyllingsmodus i nivå 1
}
if(debounce_hold(DOOR3, &DOORPIN)){ // Dersom dør 1 er åpnet...
startrefillmode(3, DOOR3, &DOORPIN); // ... start påfyllingsmodus i nivå 1
}
if(debounce_pulse(HIS, &HISPIN)){ // Dersom sensoren i bordplaten aktiveres...
dispenseunit(getcoldestlevel()); // ... start dispenseringen av en enhet
}
}
/*
Hovedprogram
*/
int main(void){
USARTInit(MYUBRR); // Initialiser USART
PWMInit(); // Initialiser PWM
SensorInit(); // Initialiser sensorport
DDRA = 0x00; // Alle pinner i port A settes til innganger.
//ADCInit() ; // Init ADC
//DDRD = 0xFF; // Port D datadir: All out.
UCPORT |= (1<<HERMESEN); // Enable Hermes
int i=0;
for(;;){
if(i++ >= 2000){ // Send status til Hermes ved jevne mellomrom.
SerialSendStatus();
i=0;
}
handle_sensors(); // HÃ¥ndter sensoraktivering/brytertrykk
}
}
Toggle field disable property (19-May @ 16:48)
Syntax Highlighted Code
- function disableField(field1,field2) {
- if(document.getElementById(field1).value == 'value1' || document.getElementById(field1).value == 'value2') {
- document.getElementById(field2).disabled = true;
- } else {
- [2 more lines...]
Plain Code
function disableField(field1,field2) {
if(document.getElementById(field1).value == 'value1' || document.getElementById(field1).value == 'value2') {
document.getElementById(field2).disabled = true;
} else {
document.getElementById(field2).disabled = false;
}
}
JavaScript AOP Framework (6-May @ 10:01)
Syntax Highlighted Code
- /**
- * AOP framework for aspect oriented programming in JavaScript
- */
- [49 more lines...]
Plain Code
/**
* AOP framework for aspect oriented programming in JavaScript
*/
var AOP = AOP || function() {
//Private methods
function toArray(iterable) {
if (!iterable) return [];
if (iterable.toArray) return iterable.toArray();
var length = iterable.length || 0, results = new Array(length);
while (length--) results[length] = iterable[length];
return results;
}
//Public methods
var public = {
around: function(obj, fname, advice) {
var oldFunc = obj[fname];
obj[fname] = function() {
var args = [oldFunc].concat(toArray(arguments));
return advice.apply(this, args);
};
},
before: function(obj, fname, advice) {
var oldFunc = obj[fname];
obj[fname] = function() {
var args = [oldFunc].concat(toArray(arguments));
advice.apply(this, args);
return oldFunc.apply(this, arguments);
};
},
after: function(obj, fname, advice) {
var oldFunc = obj[fname];
obj[fname] = function() {
var args = [oldFunc].concat(toArray(arguments));
oldFunc.apply(this, arguments);
return advice.apply(this, args);
};
},
callMethod: function(args) {
var argsArray = toArray(args);
return argsArray[0].apply(this, argsArray.slice(1));
}
};
return public;
}();
Kontera ad code (30-Apr @ 21:26)
Syntax Highlighted Code
- <!-- Kontera ContentLink -->
- <SCRIPT LANGUAGE="JavaScript">
- var dc_UnitID = 14;
- var dc_PublisherID = 12206;
- [4 more lines...]
Plain Code
<!-- Kontera ContentLink -->
<SCRIPT LANGUAGE="JavaScript">
var dc_UnitID = 14;
var dc_PublisherID = 12206;
var dc_AdLinkColor = 'blue';
var dc_adprod='ADL';
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="http://kona.kontera.com/javascript/lib/KonaLibInline.js"></SCRIPT>
<!-- Kontera ContentLink -->
Untitled JavaScript (30-Apr @ 12:27)
Syntax Highlighted Code
- <script type="text/javascript">
- $(function() {
- $(".lightbox").lightBox();
- [1 more lines...]
Plain Code
<script type="text/javascript">
$(function() {
$(".lightbox").lightBox();
});
</script>
Untitled JavaScript (29-Apr @ 11:23)
Syntax Highlighted Code
- function foo(){alert('hello')};
Plain Code
function foo(){alert('hello')};
Untitled JavaScript (29-Apr @ 11:23)
Syntax Highlighted Code
- javascript:%20Portal.Modules.PluginManager.installPlugin('org.polarion.team.svn');
Plain Code
javascript:%20Portal.Modules.PluginManager.installPlugin('org.polarion.team.svn');
Tynamitom Blogger Template (27-Apr @ 17:13)
Syntax Highlighted Code
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <html expr:dir='data:blog.languageDirection' xmlns='http://www.w3.org/1999/xhtml' xmlns:b='http://www.google.com/2005/gml/b' xmlns:data='http://www.google.com/2005/gml/data' xmlns:expr='http://www.google.com/2005/gml/expr'>
- [663 more lines...]
Plain Code
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html expr:dir='data:blog.languageDirection' xmlns='http://www.w3.org/1999/xhtml' xmlns:b='http://www.google.com/2005/gml/b' xmlns:data='http://www.google.com/2005/gml/data' xmlns:expr='http://www.google.com/2005/gml/expr'>
<head>
<b:include data='blog' name='all-head-content'/>
<title><data:blog.pageTitle/></title>
<b:skin><![CDATA[
/*
-----------------------------------------------
Blogger Template Style
Name: Rounders
Designer: Douglas Bowman
URL: www.stopdesign.com
Date: 27 Feb 2004
Updated by: Blogger Team
----------------------------------------------- */
/* Variable definitions
====================
<Variable name="mainBgColor" description="Main Background Color"
type="color" default="#fff" value="#264D76">
<Variable name="mainTextColor" description="Text Color" type="color"
default="#333" value="#99ccff">
<Variable name="postTitleColor" description="Post Title Color" type="color"
default="#333" value="#99ccff">
<Variable name="dateHeaderColor" description="Date Header Color"
type="color" default="#357" value="#99ccff">
<Variable name="borderColor" description="Post Border Color" type="color"
default="#bbb" value="#bbbbbb">
<Variable name="mainLinkColor" description="Link Color" type="color"
default="#258" value="#99ccff">
<Variable name="mainVisitedLinkColor" description="Visited Link Color"
type="color" default="#666" value="#666666">
<Variable name="titleBgColor" description="Page Header Background Color"
type="color" default="#456" value="#254C75">
<Variable name="titleTextColor" description="Blog Title Color"
type="color" default="#fff" value="#99ccff">
<Variable name="topSidebarHeaderColor"
description="Top Sidebar Title Color"
type="color" default="#234" value="#254C75">
<Variable name="topSidebarBgColor"
description="Top Sidebar Background Color"
type="color" default="#cdc" value="#264D76">
<Variable name="topSidebarTextColor" description="Top Sidebar Text Color"
type="color" default="#345" value="#334455">
<Variable name="topSidebarLinkColor" description="Top Sidebar Link Color"
type="color" default="#258" value="#225588">
<Variable name="topSidebarVisitedLinkColor"
description="Top Sidebar Visited Link Color"
type="color" default="#258" value="#225588">
<Variable name="bodyFont" description="Text Font" type="font"
default="normal normal 100% 'Trebuchet MS',Verdana,Arial,Sans-serif" value="normal normal 100% 'Trebuchet MS',Verdana,Arial,Sans-serif">
<Variable name="pageTitleFont" description="Blog Title Font" type="font"
default="normal bold 200% 'Trebuchet MS',Verdana,Arial,Sans-serif" value="normal bold 200% 'Trebuchet MS',Verdana,Arial,Sans-serif">
<Variable name="descriptionFont" description="Blog Description Font" type="font"
default="normal normal 100% 'Trebuchet MS',Verdana,Arial,Sans-serif" value="normal normal 100% 'Trebuchet MS',Verdana,Arial,Sans-serif">
<Variable name="headerFont" description="Sidebar Title Font" type="font"
default="normal bold 100% 'Trebuchet MS',Verdana,Arial,Sans-serif" value="normal bold 100% 'Trebuchet MS',Verdana,Arial,Sans-serif">
<Variable name="postTitleFont" description="Post Title Font" type="font"
default="normal bold 135% 'Trebuchet MS',Verdana,Arial,Sans-serif" value="normal bold 135% 'Trebuchet MS',Verdana,Arial,Sans-serif">
<Variable name="startSide" description="Start side in blog language"
type="automatic" default="left" value="left">
<Variable name="endSide" description="End side in blog language"
type="automatic" default="right" value="right">
*/
body {
background-image:url('http://tynamite.uk.to/back.png');
margin:0;
text-align:center;
line-height: 1.5em;
font:x-small Trebuchet MS, Verdana, Arial, Sans-serif;
color:$mainTextColor;
font-size/* */:/**/small;
font-size: /**/small;
}
/* Page Structure
----------------------------------------------- */
/* The images which help create rounded corners depend on the
following widths and measurements. If you want to change
these measurements, the images will also need to change.
*/
#outer-wrapper {
width:740px;
left:100px;
margin-left: 70px;
margin-top: 110px;
text-align:$startSide;
font: $bodyFont;
}
#main-wrap1 {
width:475px;
float:$startSide;
background-color: $topSidebarBgColor;
margin:15px 0 0;
border: 0px;
color:$mainTextColor;
font-size:97%;
line-height:1.5em;
border: 8px solid #0C3762;
word-wrap: break-word; /* fix for long text breaking sidebar float in IE */
overflow: hidden; /* fix for long non-text content breaking IE sidebar float */
}
#main-wrap2 {
float: $startSide;
width: 100%;
padding: 0px 0 0;
}
#main {
/* those left and right borders */
padding:0;
width:475px;
}
#sidebar-wrap {
width:240px;
float:$endSide;
margin:15px 0 0;
font-size:97%;
line-height:1.5em;
word-wrap: break-word; /* fix for long text breaking sidebar float in IE */
overflow: hidden; /* fix for long non-text content breaking IE sidebar float */
}
.main .widget {
margin-top: 4px;
width: 468px;
padding: 0 13px;
}
.main .Blog {
margin: 0;
padding: 0;
width: 484px;
}
/* Links
----------------------------------------------- */
a:link {
color: $mainLinkColor;
}
a:visited {
color: $mainVisitedLinkColor;
}
a:hover {
color: $mainVisitedLinkColor;
}
a img {
border-width:0;
}
/* Blog Header
----------------------------------------------- */
#header-wrapper {
border: 8px solid #0C3762;
background-color: $titleBgColor;
color:$titleTextColor;
margin-top:22px;
margin-$endSide:0;
margin-bottom:0;
margin-$startSide:0;
padding-top:8px;
padding-$endSide:0;
padding-bottom:0;
padding-$startSide:0;
}
#header {
padding:0 15px 8px;
}
#header h1 {
margin:0;
padding:10px 30px 5px;
line-height:1.2em;
font: $pageTitleFont;
}
#header a,
#header a:visited {
text-decoration:none;
color: $titleTextColor;
}
#header .description {
margin:0;
padding:5px 30px 10px;
line-height:1.5em;
font: $descriptionFont;
}
/* Posts
----------------------------------------------- */
h2.date-header {
margin-top:0;
margin-$endSide:28px;
margin-bottom:0;
margin-$startSide:43px;
font-size:85%;
line-height:2em;
text-transform:uppercase;
letter-spacing:.2em;
color:$dateHeaderColor;
}
.post {
margin:.3em 0 25px;
padding:0 13px;
border:1px dotted $borderColor;
border-width:1px 0;
}
.post h3 {
margin:0;
line-height:1.5em;
background:url("http://www2.blogblog.com/rounders/icon_arrow.gif") no-repeat 10px .5em;
display:block;
border:1px dotted $borderColor;
border-width:0 1px 1px;
padding-top:2px;
padding-$endSide:14px;
padding-bottom:2px;
padding-$startSide:29px;
color: $postTitleColor;
font: $postTitleFont;
}
.post h3 a, .post h3 a:visited {
text-decoration:none;
color: $postTitleColor;
}
a.title-link:hover {
background-color: $borderColor;
color: $mainTextColor;
}
.post-body {
border:1px dotted $borderColor;
border-width:0 1px 1px;
border-bottom-color:$mainBgColor;
padding-top:10px;
padding-$endSide:14px;
padding-bottom:1px;
padding-$startSide:29px;
}
html>body .post-body {
border-bottom-width:0;
}
.post-body {
margin:0 0 .75em;
}
.post-body blockquote {
line-height:1.3em;
}
.post-footer {
background: #ded;
margin:0;
padding-top:2px;
padding-$endSide:14px;
padding-bottom:2px;
padding-$startSide:29px;
border:1px dotted $borderColor;
border-width:1px;
font-size:100%;
line-height:1.5em;
color: #666;
}
/*
The first line of the post footer might only have floated text, so we need to give it a height.
The height comes from the post-footer line-height
*/
.post-footer-line-1 {
min-height:1.5em;
_height:1.5em;
}
.post-footer p {
margin: 0;
}
html>body .post-footer {
border-bottom-color:transparent;
}
.uncustomized-post-template .post-footer {
text-align: $endSide;
}
.uncustomized-post-template .post-author,
.uncustomized-post-template .post-timestamp {
display: block;
float: $startSide;
text-align:$startSide;
margin-$endSide: 4px;
}
.post-footer a {
color: #258;
}
.post-footer a:hover {
color: #666;
}
a.comment-link {
/* IE5.0/Win doesn't apply padding to inline elements,
so we hide these two declarations from it */
background/* */:/**/url("http://www.blogblog.com/rounders/icon_comment_$startSide.gif") no-repeat $startSide 45%;
padding-$startSide:14px;
}
html>body a.comment-link {
/* Respecified, for IE5/Mac's benefit */
background:url("http://www.blogblog.com/rounders/icon_comment_$startSide.gif") no-repeat $startSide 45%;
padding-$startSide:14px;
}
.post img {
margin-top:0;
margin-$endSide:0;
margin-bottom:5px;
margin-$startSide:0;
padding:4px;
border:1px solid $borderColor;
}
blockquote {
margin:.75em 0;
border:1px dotted $borderColor;
border-width:1px 0;
padding:5px 15px;
color: $dateHeaderColor;
}
.post blockquote p {
margin:.5em 0;
}
#blog-pager-newer-link {
float: $startSide;
margin-$startSide: 13px;
}
#blog-pager-older-link {
float: $endSide;
margin-$endSide: 13px;
}
#blog-pager {
text-align: center;
}
.feed-links {
clear: both;
line-height: 2.5em;
margin-$startSide: 13px;
}
/* Comments
----------------------------------------------- */
#comments {
margin:-25px 13px 0;
border:1px dotted $borderColor;
border-width:0 1px 1px;
padding-top:20px;
padding-$endSide:0;
padding-bottom:15px;
padding-$startSide:0;
}
#comments h4 {
margin:0 0 10px;
padding-top:0;
padding-$endSide:14px;
padding-bottom:2px;
padding-$startSide:29px;
border-bottom:1px dotted $borderColor;
font-size:120%;
line-height:1.4em;
color:$postTitleColor;
}
#comments-block {
margin-top:0;
margin-$endSide:15px;
margin-bottom:0;
margin-$startSide:9px;
}
.comment-author {
background:url("http://www.blogblog.com/rounders/icon_comment_$startSide.gif") no-repeat 2px .3em;
margin:.5em 0;
padding-top:0;
padding-$endSide:0;
padding-bottom:0;
padding-$startSide:20px;
font-weight:bold;
}
.comment-body {
margin:0 0 1.25em;
padding-top:0;
padding-$endSide:0;
padding-bottom:0;
padding-$startSide:20px;
}
.comment-body p {
margin:0 0 .5em;
}
.comment-footer {
margin:0 0 .5em;
padding-top:0;
padding-$endSide:0;
padding-bottom:.75em;
padding-$startSide:20px;
}
.comment-footer a:link {
color: #333;
}
.deleted-comment {
font-style:italic;
color:gray;
}
.comment-form {
padding-$startSide:20px;
padding-$endSide:5px;
}
#comments .comment-form h4 {
padding-$startSide:0px;
}
/* Profile
----------------------------------------------- */
.profile-img {
float: $startSide;
margin-top: 5px;
margin-$endSide: 5px;
margin-bottom: 5px;
margin-$startSide: 0;
border: 4px solid $topSidebarTextColor;
}
.profile-datablock {
margin-top:0;
margin-$endSide:15px;
margin-bottom:.5em;
margin-$startSide:0;
padding-top:8px;
}
.profile-link {
background:url("http://www.blogblog.com/rounders/icon_profile_$startSide.gif") no-repeat $startSide .1em;
padding-$startSide:15px;
font-weight:bold;
}
.profile-textblock {
clear: both;
margin: 0;
}
.sidebar .clear, .main .widget .clear {
clear: both;
}
#sidebartop-wrap {
border: 8px solid #0C3762;
background-color: $topSidebarBgColor;
margin:0px 0px 15px;
padding:0px 0px 10px;
color:$topSidebarTextColor;
}
#sidebartop-wrap2 {
padding: 10px 0 0;
margin:0;
border-width:0;
}
#sidebartop h2 {
line-height:1.5em;
color:$topSidebarHeaderColor;
border-bottom: 1px dotted $topSidebarHeaderColor;
margin-bottom: 0.5em;
font: $headerFont;
}
#sidebartop a {
color: $topSidebarLinkColor;
}
#sidebartop a:hover {
color: $topSidebarVisitedLinkColor;
}
#sidebartop a:visited {
color: $topSidebarVisitedLinkColor;
}
/* Sidebar Boxes
----------------------------------------------- */
.sidebar .widget {
margin:.5em 13px 1.25em;
padding:0 0px;
}
.widget-content {
margin-top: 0.5em;
}
#sidebarbottom-wrap1 {
border: 8px solid #0C3762;
background-color: $topSidebarBgColor;
margin:0 0 15px;
padding:10px 0 0;
color: $mainTextColor;
}
#sidebarbottom-wrap2 {
padding:0 0 8px;
}
.sidebar h2 {
margin:0;
padding:0 0 .2em;
line-height:1.5em;
font:$headerFont;
}
.sidebar ul {
list-style:none;
margin:0 0 1.25em;
padding:0;
}
.sidebar ul li {
background:url("http://www2.blogblog.com/rounders/icon_arrow_sm.gif") no-repeat 2px .25em;
margin:0;
padding-top:0;
padding-$endSide:0;
padding-bottom:3px;
padding-$startSide:16px;
margin-bottom:3px;
border-bottom:1px dotted $borderColor;
line-height:1.4em;
}
.sidebar p {
margin:0 0 .6em;
}
#sidebar h2 {
color: $postTitleColor;
border-bottom: 1px dotted $postTitleColor;
}
/* Footer
----------------------------------------------- */
#footer-wrap1 {
clear:both;
margin:0 0 10px;
padding:15px 0 0;
}
#footer-wrap2 {
background:$titleBgColor url("http://www2.blogblog.com/rounders/corners_cap_top.gif") no-repeat $startSide top;
color:$titleTextColor;
}
#footer {
background:url("http://www.blogblog.com/rounders/corners_cap_bot.gif") no-repeat $startSide bottom;
padding:8px 15px;
}
#footer hr {display:none;}
#footer p {margin:0;}
#footer a {color:$titleTextColor;}
#footer .widget-content {
margin:0;
}
/** Page structure tweaks for layout editor wireframe */
body#layout #main-wrap1,
body#layout #sidebar-wrap,
body#layout #header-wrapper {
margin-top: 0;
}
body#layout #header, body#layout #header-wrapper,
body#layout #outer-wrapper {
margin-$startSide:0,
margin-$endSide: 0;
padding: 0;
}
body#layout #outer-wrapper {
width: 730px;
}
body#layout #footer-wrap1 {
padding-top: 0;
}
]]></b:skin>
</head>
<body>
<div id='outer-wrapper'>
<div id='header-wrapper'>
<b:section class='header' id='header' maxwidgets='1'>
<b:widget id='Header1' locked='true' title='Tynami-pages (Header)' type='Header'/>
</b:section>
</div>
<div id='crosscol-wrapper' style='text-align:center'>
<b:section class='crosscol' id='crosscol' showaddelement='no'/>
</div>
<div id='main-wrap1'><div id='main-wrap2'>
<b:section class='main' id='main' showaddelement='no'>
<b:widget id='Blog1' locked='true' title='Blog Posts' type='Blog'/>
</b:section>
</div></div>
<div id='sidebar-wrap'>
<div id='sidebartop-wrap'><div id='sidebartop-wrap2'>
<b:section class='sidebar' id='sidebartop'>
<b:widget id='Profile1' locked='false' title='About Me' type='Profile'/>
</b:section>
</div></div>
<div id='sidebarbottom-wrap1'><div id='sidebarbottom-wrap2'>
<b:section class='sidebar' id='sidebar' preferred='yes'>
<b:widget id='LinkList1' locked='false' title='All my websites' type='LinkList'/>
<b:widget id='BlogArchive1' locked='false' title='Blog Archive' type='BlogArchive'/>
</b:section>
</div></div>
</div>
<div id='footer-wrap1'><div id='footer-wrap2'>
<b:section class='footer' id='footer'/>
</div></div>
<!-- Start of StatCounter Code -->
<script type='text/javascript'>
var sc_project=4677138;
var sc_invisible=0;
var sc_partition=56;
var sc_click_stat=1;
var sc_security="f4c96873";
</script>
<script src='http://www.statcounter.com/counter/counter_xhtml.js' type='text/javascript'/>
<!-- End of StatCounter Code -->
</div>
</body>
</html>
Untitled JavaScript (18-Apr @ 14:09)
Syntax Highlighted Code
- function jQueryable(value, context) {
- var ret;
- // jQuery object
- [15 more lines...]
Plain Code
function jQueryable(value, context) {
var ret;
// jQuery object
if (value.jquery) {
// do nothing, already a jQuery object
}
// DOMElement
// array
// selector
else if (value.nodeType || value.length || typeof value == 'string') {
ret = $(value, context);
}
// function
else if ($.isFunction(value)) {
ret = value(context);
}
return ret;
}
Untitled JavaScript (9-Apr @ 13:31)
Syntax Highlighted Code
- alert ("Hello");
Plain Code
alert ("Hello");
Untitled JavaScript (8-Apr @ 12:05)
Syntax Highlighted Code
- jQuery(document).ready
- (
- function()
- {
- [76 more lines...]
Plain Code
jQuery(document).ready
(
function()
{
jQuery.post
(
"adauga_poze_nexus.php",
{
act: "update_poza",
id_poza: "338",
optiuni: "12#"
},
function(data)
{
jQuery("#dpoza338").html(data);
}
);
jQuery.post
(
"adauga_poze_nexus.php",
{
act: "update_poza",
id_poza: "337",
optiuni: "12#"
},
function(data)
{
jQuery("#dpoza337").html(data);
}
);
jQuery.post
(
"adauga_poze_nexus.php",
{
act: "update_poza",
id_poza: "336",
optiuni: "12#"
},
function(data)
{
jQuery("#dpoza336").html(data);
}
);
jQuery.post
(
"adauga_poze_nexus.php",
{
act: "update_poza",
id_poza: "335",
optiuni: "12#"
},
function(data)
{
jQuery("#dpoza335").html(data);
}
);
jQuery.post
(
"adauga_poze_nexus.php",
{
act: "update_poza",
id_poza: "334",
optiuni: "12#"
},
function(data)
{
jQuery("#dpoza334").html(data);
}
);
}
);
jQuery("#idPachet").change
(
function()
{
jQuery("#test").html("buhu");
}
);
Untitled JavaScript (7-Apr @ 15:44)
Syntax Highlighted Code
- jQuery(document).ready
- (
- function()
- {
- [22 more lines...]
Plain Code
jQuery(document).ready
(
function()
{
jQuery(".dpoza").each
(
function()
{
jQuery(this).post
(
"adauga_poze_nexus.php",
{
act: "update_poza",
id_poza: jQuery(this).attr("id"),
optiuni: "12#"
},
function(data)
{
alert(data);
}
);
}
);
}
);
Untitled JavaScript (7-Apr @ 15:30)
Syntax Highlighted Code
- jQuery(document).ready(function(){
- jQuery(".dpoza").each(function(){
- var id = jQuery(this).attr("id");
- jQuery(this).post("_nexus.php",{id:id,mode="test"},function(data){
- [4 more lines...]
Plain Code
jQuery(document).ready(function(){
jQuery(".dpoza").each(function(){
var id = jQuery(this).attr("id");
jQuery(this).post("_nexus.php",{id:id,mode="test"},function(data){
alert(data);
// Other callback
});
});
});
Untitled JavaScript (4-Mar @ 15:15)
Syntax Highlighted Code
- var test = 31;
Plain Code
var test = 31;
Untitled JavaScript (26-Feb @ 11:53)
Syntax Highlighted Code
- window.addEvent('domready',function(){
- var contentHeight = $('contentDetailScroll').offsetHeight;
- var scroll = new Fx.Scroll('contentDetailScroll', {
- wait: false,
- [22 more lines...]
Plain Code
window.addEvent('domready',function(){
var contentHeight = $('contentDetailScroll').offsetHeight;
var scroll = new Fx.Scroll('contentDetailScroll', {
wait: false,
duration: 500,
offset: {'x': 0, 'y': 0},
transition: Fx.Transitions.Quad.easeInOut
});
$('intvntScrollUp').addEvent('click', function(event) {
event = new Event(event).stop();
actualUpPosition = $('contentDetailScroll').getScroll();
stepUp = actualUpPosition.y - 100;
// alert('Scroll position actuel : '+actualUpPosition.y+' - Step actuel : '+stepUp);
scroll.start(0, stepUp);
});
$('intvntScrollDown').addEvent('click', function(event) {
event = new Event(event).stop();
actualDwnPosition = $('contentDetailScroll').getScroll();
stepDwn = actualDwnPosition.y + 100;
// alert('Scroll position actuel : '+actualDwnPosition.y+' - Step actuel : '+stepDwn);
scroll.start(0, stepDwn);
});
});
Untitled JavaScript (23-Feb @ 19:37)
Syntax Highlighted Code
- ( function test( $ )
- {
- console.debug( $ );
- } )( jQuery );
Plain Code
( function test( $ )
{
console.debug( $ );
} )( jQuery );
Untitled JavaScript (23-Feb @ 08:01)
Syntax Highlighted Code
- /**
- * @author Andre Berg
- *
- * @copyright 2009 Berg Media. All rights reserved.
- [359 more lines...]
Plain Code
/**
* @author Andre Berg
*
* @copyright 2009 Berg Media. All rights reserved.
*
* @license On "as-is" basis. Use at your own risk!
* Free to use personally and commercially,
* free to modify with the limitation that
* it must be made obvious (marked) what was changed.
* Free to distribute, with the limitation that this
* description text incl. author name copyright and
* license must be included without exceptions.
*
* @info Various utility functions mostly pure JS but sometimes
* built around/for jQuery
*
* @deps JavaScript 1.3+ and jQuery 1.2.x
*
*/
/**
* A lightweight, small footprint DOM Builder.
*
* @param {Object} p
* @param {Object} t
*/
function TAGNAME(p, t) {
for (var i in t)
typeof(t[i]) == 'object' ?
TAGNAME(p.appendChild(document.createElement(i.split('_')[0])), t[i])
: i == 's' ?
p.style.cssText = t[i]
: i == 't' ?
p.appendChild(document.createTextNode(t[i]))
: p[i] = t[i];
return p
}
var min = function() {
return Math.min.apply(Math, arguments);
}
/**
* Returns the true type of x. The JavaScript keyword 'typeof'
* doesn't work reliably enough. For example it returns Arrays as Objects.
* This method was invented by Mark Miller.
*/
function typeOf(x) {
var res = Object.prototype.toString.apply(x);
if (res === '[object Array]') {
return 'Array';
} else if (res === '[object Object]') {
return 'Object';
} else if (res === '[object Number]') {
return 'Number';
} else {
return 'Unknown';
}
}
// STRING UTILS //
// Some convenience functions inspired by AppleScript (heh...)
/**
* Convenience method to check if a string starts with a certain string.
* @param {String} str
* @return {Boolean} true/false
*/
String.prototype.startsWith = function(str) {
return (this.indexOf(str) == 0);
};
/**
* Convenience method to check if a string ends with a certain string.
* @param {String} str
* @return {Boolean} true/false
*/
String.prototype.endsWith = function(str) {
return (this.indexOf(str) == this.length - str.length);
};
/**
* Convenience method to check if a string contains a certain string.
* @param {String} str
* @return {Boolean} true/false
*/
String.prototype.contains = function(str) {
return (this.indexOf(str) > -1);
};
/**
* Trims whitespace off both ends of a string.
* Best all around approach of dealing with cases of mixed length.
* @return {String} the trimmed string
*/
String.prototype.trim = function() {
return this.replace(/^\s\s*/, '').replace(/\s\s*$/,'');
};
/**
* Trims whitespace off both ends of a string.
* This function is especially suited for large texts because it
* starts to trim whitespace from the end by looping backwards
* and stopping at the first sign of a non-whitespace character.
*
* @return {String} the trimmed string
*/
String.prototype.trim2 = function() {
var str = this.replace(/^\s\s*/, '');
for (var i = str.length - 1; i >= 0; i--) {
if (/\S/.test(str.charAt(i))) {
str = str.substring(0, i + 1);
break;
}
}
return str;
};
/**
* Trims whitespace of of both ends of a string.
* Uses a non-regex approach for the trimming which might yield better results
* with strings that have excessive amounts of leading whitespace.
* One caveat; MSIE might show problems with matching the \v (vertical tab) character
* included in the whitespace string variable.
*
* @return {String} the trimmed string
*/
String.prototype.fastTrim = function() {
var s = this;
var whitespace = ' \n\r\t\v\f\u00a0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000';
var i = 0, j = s.length - 1;
while (i < s.length && whitespace.indexOf(s.charAt(i)) != -1)
i++;
while (j > i && whitespace.indexOf(s.charAt(j)) != -1)
j--;
return s.substring(i, j + 1);
}
/**
* Trims whitespace off the left side of a string.
* @return {String} the trimmer string
*/
String.prototype.trimLeft = function() {
return this.replace(/^\s+/, '');
};
/**
* Trims whitespace off the right side of a string.
* @return {String} the trimmer string
*/
String.prototype.trimRight = function() {
var str = this;
for (var i = str.length - 1; i >= 0; i--) {
if (/\S/.test(str.charAt(i))) {
str = str.substring(0, i + 1);
break;
}
}
return str;
};
// ARRAY UTILS //
/**
* Returns the smallest number in an array.
* @param {Array} array an array of Numbers
* @return {Number} the smallest number in the array.
*/
Array.prototype.min = function(){ return Math.min.apply( Math, this ); };
/**
* Returns the largest number in an array.
* @param {Array} array an array of Numbers
* @return {Number} the largest number in the array.
*/
Array.prototype.max = function(){ return Math.max.apply( Math, this ); };
/**
* Takes the sum of numeric arrays.
* @return {Number} the total of all members added together
*/
Array.prototype.sum = function() {
var total = 0;
for(var i = 0; i < this.length; i++) {
total += this[i];
}
return total;
};
/**
* Returns a slice of an array. Has negative slicing support.
* Numbers bigger than array length are wrapped around, e.g. 12 for length of 10 gives 2.
* This works both with negative and positive numbers, except when to is positive and from
* is smaller than array length. In this case to will be set to array.length.
*
* @param {Number} from start of the slice
* @param {Number} to end of the slice
*
* @return {Array} the new sliced array
*/
Array.prototype.slice = function(from ,to) {
var newArr = [];
var len = this.length;
if (!to) to = len;
if (!from) from = 0;
if (to > len) to = len;
// support for negative slicing
// from either or both ends
if (from < 0 && to < 0) {
from = ((from % len) + len);
to = ((to % len) + len);
}
else if (from < 0) {
from = ((from % len) + len);
}
else if (to < 0) {
to = ((to % len) + len);
}
var f1 = from;
var t1 = to;
from = Math.min(f1, t1);
to = Math.max(f1, t1);
// console.log("from = " + from + ", to = " + to + ", len = " + len);
if (from == to || from > len)
return newArr;
for (var i = from; i < to; i++) {
newArr.push(this[i]);
}
return newArr;
};
/**
* Assert that an expression is either true or false.
* Compare to what was expected (either passes or fails for that assumption).
* You can either pass your own info message (recommended, since it is somewhat faster)
* in which you declare what you expect the outcome of the evaluation to be.
* For example: "expr should be true" or "expr will fail".
* You can also just use "true", "false", "pass" or "fail" for msg and have the function generate
* the info message for you (slower). assert() takes around 5-8ms per call on a fast machine.
*
* You can block assertions globally by setting window.BLOCK_ASSERTIONS to true.
*
* @param {Expression} expr the expression to evaluate
* @param {String} msg the expectational message i.e. "expr should be true" or "expr will fail"
* @param {Boolean} alertOnError if true posts an alert() on AssertionError (=> outcome differs from expectation).
* Of course this won't make much of a difference if alert() is the only available debugging tool.
*
* @return {Boolean} evaluation state of expr
*/
function assert(expr, msg, alertOnError) {
var BLOCK_ASSERTIONS = window.BLOCK_ASSERTIONS || false;
if (BLOCK_ASSERTIONS) return false;
var pass = "pass";
var fail = "fail";
var s = [pass, fail];
var state = expr ? true : false;
var slabel = s[state?1:0];
var anypat = /(fail|pass|true|false)/i;
var onlypat = /^(fails?|pass(es)?|true|false)$/i;
var passpat = /(pass|true)/i;
var failpat = /(fail|false)/i;
var logf = console.log ? console.log : alert;
// defaults
alertOnError = alertOnError || false;
msg = msg || slabel;
// parse expectation message for the intended outcome of the evaluation
var expect = anypat.test(msg) ? msg.match(anypat)[0] : slabel;
// cache some essential comparisons
var ismatch = (slabel == expect || slabel == s[expect?1:0]);
if (onlypat.test(msg)) {
// prep a default info string if msg only contains one of these words.
// caveat: this is quite costly in terms of performance in critical code
// ergo it's always best to define your own message for msg
msg = "Was expected to " + (/true|false/.test(expect) ? "be " : "") + expect + " " + (ismatch ? "and" : "but") + " " + slabel + (slabel == pass ? "es" : "s");
}
if (!anypat.test(msg)) {
// msg contains neither pattern indicative for what the outcome should be
// which means an AssertionError cannot be detected and we just log
// the outcome without breaking/alerting on AssertionError
alertOnError = false;
}
if (!ismatch) {
(alertOnError ? alert : logf)("AssertionError: " + slabel.toUpperCase() + ": " + msg);
} else {
logf(slabel.toUpperCase() + ": " + msg);
}
return ismatch;
}
/**
* A logging function which logs an arbitrary amount of arguments
* to the console or via alert depending on whats available.
*
* One calls the log() function with any amount of arguments which are
* concatenated as strings and output to the logging device.
*
* @return {Boolean} true if logging succeeded, false if logging was blocked
* by the global variable window.BLOCK_LOGS
*/
function log(){
BLOCK_LOGS = window.BLOCK_LOGS || false;
if (BLOCK_LOGS) return false;
var logf = console.log ? console.log : out.println ? out.println : alert;
var msg = "";
for ( var i = 0; i < arguments.length; i++ ) {
msg += " " + arguments[i];
}
logf(msg);
return true;
}
/**
* A simple timing function.
* @param {Number} n number of loops. more means more accuracy
* @param {Function} func the function to execute
* @param {Any} arguments for the function you can pass as many as you like or none
*
* @return {Number} the average execution time in ms
*/
function time(n, func) {
var args = [];
for (var j = 2; j < arguments.length; j++)
args.push(arguments[j]);
if (args.length > 0) {
var t0 = new Date().getTime();
for (var i = 0; i < n; i++) {
func.apply(this, args);
};
var t1 = new Date().getTime();
} else {
var t0 = new Date().getTime();
for (var i = 0; i < n; i++) {
func.call(this);
}
var t1 = new Date().getTime();
}
return (t1 - t0) / n;
};
Untitled JavaScript (20-Feb @ 14:01)
Syntax Highlighted Code
- // builds a PHP-compatible query string from a hash
- // includes support for arrays and hashes
- function param(data) {
- // array of key=value pairs to build the query string
- [34 more lines...]
Plain Code
// builds a PHP-compatible query string from a hash
// includes support for arrays and hashes
function param(data) {
// array of key=value pairs to build the query string
var processed = [];
// adds a key/value pair to the processed array
// index is used for assoc and non-assoc arrays
function add(key, value, index) {
var encoded = encodeURIComponent(key);
if (typeof index == 'string') {
encoded += '[' + encodeURIComponent(index) + ']';
}
encoded += '=' + encodeURIComponent(value);
processed.push(encoded);
}
$.each(data, function(key, value) {
// skip null/undefined
if (value === null || value === undefined) { return; }
// handle simple values
if (typeof value == 'string' || typeof value == 'number') {
add(key, value);
// handle arrays
} else if ($.isArray(value)) {
$.each(value, function() {
add(key, this, '');
});
// handle hashes
} else {
$.each(value, function(hashKey, hashValue) {
add(key, hashValue, hashKey);
});
}
});
return processed.join('&').replace(/%20/g, '+');
}
Untitled JavaScript (13-Feb @ 14:22)
Syntax Highlighted Code
- bindFirst: function(types, data, fn) {
- return this.each(function(index, elem) {
- $.each(types.split(/\s+/), function(index, type) {
- var eventType = type.split(".").shift(),
- [13 more lines...]
Plain Code
bindFirst: function(types, data, fn) {
return this.each(function(index, elem) {
$.each(types.split(/\s+/), function(index, type) {
var eventType = type.split(".").shift(),
events = $.data(elem, "events"),
originalEvents = events && events[eventType] || null;
if (!originalEvents) {
return $(elem).bind(type, data, fn);
}
events[eventType] = {};
$(elem).bind(type, data, fn);
$.extend(events[eventType], originalEvents);
});
});
}
Untitled JavaScript (13-Feb @ 14:12)
Syntax Highlighted Code
- bindFirst: function(types, data, fn) {
- return this.each(function(index, elem) {
- $.each(types.split(/\s+/), function(index, type) {
- var eventType = type.split(".").shift(),
- [13 more lines...]
Plain Code
bindFirst: function(types, data, fn) {
return this.each(function(index, elem) {
$.each(types.split(/\s+/), function(index, type) {
var eventType = type.split(".").shift(),
events = $.data(elem, "events"),
originalEvents = events && events[eventType] ? events[eventType] : {};
if (!originalEvents) {
return $(elem).bind(type, data, fn);
}
events[eventType] = {};
$(elem).bind(type, data, fn);
$.extend(events[eventType], originalEvents);
});
});
}
Untitled JavaScript (13-Feb @ 14:07)
Syntax Highlighted Code
- // TODO: support multiple types
- bindFirst: function(type, data, fn) {
- var args = arguments,
- eventType = type;
- [13 more lines...]
Plain Code
// TODO: support multiple types
bindFirst: function(type, data, fn) {
var args = arguments,
eventType = type;
return this.each(function() {
var events = $.data(this, "events"),
originalEvents = events && events[eventType] ? events[eventType] : {};
if (!originalEvents) {
return $(this).bind(type, data, fn);
}
events[eventType] = {};
$(this).bind(type, data, fn);
$.extend(events[eventType], originalEvents);
});
}
JavaScript event delegator template (10-Feb @ 13:48)
Syntax Highlighted Code
- window.onload = function () { var navigation = document.getElementById("some_element_high_up_in_the_hierarchy");
- navigation.onclick = function (evt) {
- // Event tweaks, since IE wants to go its own way...
- var event = evt || window.event;
- [5 more lines...]
Plain Code
window.onload = function () { var navigation = document.getElementById("some_element_high_up_in_the_hierarchy");
navigation.onclick = function (evt) {
// Event tweaks, since IE wants to go its own way...
var event = evt || window.event;
var target = event.target || event.srcElement;
if(target.className && target.className==='someClass') {
//do your stuff here
}
}
};
jQuery indexOf (9-Feb @ 00:11)
Syntax Highlighted Code
- $(el).prevAll().length;
Plain Code
$(el).prevAll().length;
Untitled JavaScript (2-Feb @ 16:51)
Syntax Highlighted Code
- 28ded51460348e2179e0b1ee3ae35ca5ed6a7f01
Plain Code
28ded51460348e2179e0b1ee3ae35ca5ed6a7f01
Untitled JavaScript (2-Feb @ 03:37)
Syntax Highlighted Code
- function testWidgetDefaults(widget, defaults) {
- var pluginDefaults = $.extend({},
- $.widget.defaults,
- $.ui[widget].defaults
- [74 more lines...]
Plain Code
function testWidgetDefaults(widget, defaults) {
var pluginDefaults = $.extend({},
$.widget.defaults,
$.ui[widget].defaults
);
// ensure that all defualts have the correct value
test('defined defaults', function() {
$.each(defaults, function(key, val) {
same(pluginDefaults[key], val, key);
});
});
// ensure that all defaults were tested
test('tested defaults', function() {
$.each(pluginDefaults, function(key) {
ok(key in defaults, key);
});
});
// defaults after init
test('defaults on init', function() {
var el = $('<div/>')[widget](),
instance = el.data(widget);
$.each(defaults, function(key, val) {
same(instance.options[key], val, key);
});
el.remove();
});
}
function testSettingOptions(widget, options) {
test('option values', function() {
var el = $('<div/>')[widget](),
instance = el.data(widget);
$.each(options, function(i, option) {
$.each({
'null': null,
'false': false,
'true': true,
zero: 0,
number: 1,
'empty string': '',
string: 'string',
'empty array': [],
array: ['array'],
'empty object': {},
object: {obj: 'ect'},
date: new Date(),
regexp: /regexp/,
'function': function() {}
}, function(type, val) {
el[widget]('option', option, val);
same(instance.options[option], val, option + ': ' + type);
});
});
});
}
function testWidgetOverrides(widget) {
test('$.widget overrides', function() {
$.each(['option', '_getData', '_trigger'], function(i, method) {
ok($.widget.prototype[method] == $.ui[widget].prototype[method],
'should not override ' + method);
});
});
}
function commonWidgetTests(widget, settings) {
var options = [];
$.each(settings.defaults, function(option) {
options.push(option);
});
testWidgetDefaults(widget, settings.defaults);
// testSettingOptions(widget, options);
testWidgetOverrides(widget);
}
Untitled JavaScript (30-Jan @ 05:42)
Syntax Highlighted Code
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
- [267 more lines...]
Plain Code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<meta content="en-us" http-equiv="Content-Language" />
<meta content="Twitter is a free social messaging utility for staying connected in real-time" name="description" />
<meta content="no" http-equiv="imagetoolbar" />
<meta content="width = 780" name="viewport" />
<meta content="4FTTxY4uvo0RZTMQqIyhh18HsepyJOctQ+XTOu1zsfE=" name="verify-v1" />
<meta content="y" name="session-loggedin" />
<meta content="19577182" name="session-userid" />
<meta content="biophylia" name="session-user-screen_name" />
<meta content="poecooper" name="page-user-screen_name" />
<title>Twitter / poecooper</title>
<link href="http://assets1.twitter.com/images/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<link href="http://assets1.twitter.com/images/twitter_57.png" rel="apple-touch-icon" />
<link href="http://assets2.twitter.com/stylesheets/screen.css?1233275810" media="screen, projection" rel="stylesheet" type="text/css" />
<link href="http://assets2.twitter.com/stylesheets/master.css?1233275806" media="screen, projection" rel="stylesheet" type="text/css" />
<link href="http://assets2.twitter.com/stylesheets/ie.css?1233275807" media="screen, projection" rel="stylesheet" type="text/css" />
<style type="text/css">
body { background: #9ae4e8 url(http://assets2.twitter.com/images/bg.gif) fixed no-repeat top left; }
div.content-bubble-arrow { margin-top: 6px; padding-top: 11px; background: url(http://static.twitter.com/images/arr2.gif) no-repeat 25px 0px; }
.status-btn input.round-btn { background: url('http://static.twitter.com/images/round-btn.gif'); }
.status-btn input.round-btn:hover { background: url('http://static.twitter.com/images/round-btn-hover.gif'); }
.status-btn input.disabled, .status-btn input.disabled:hover { background: url('http://static.twitter.com/images/round-btn.gif'); }
.hentry .actions .fav { background-image: url('http://static.twitter.com/images/icon_star_full.gif'); }
.hentry .actions .non-fav { background-image: url('http://static.twitter.com/images/icon_star_empty.gif'); }
.hentry .actions .fav-throb, .hentry .actions a.del-throb { background-image: url('http://static.twitter.com/images/icon_throbber.gif'); }
.hentry .actions .del { background-image: url('http://static.twitter.com/images/icon_trash.gif'); }
body#show .repl, .hentry .actions .repl { background-image: url('http://static.twitter.com/images/icon_reply.gif'); }
.direct_message .actions .repl { background-image: url('http://static.twitter.com/images/icon_direct_reply.gif'); }
.direct_message .actions .del { background-image: url('http://static.twitter.com/images/icon_trash.gif'); }
.notify { background-image: url('http://static.twitter.com/images/girl.gif'); }
.promotion, ul#tabMenu a#keyword_search_tab.hover, ul#tabMenu a:hover { background-image: url('http://static.twitter.com/images/pale.png'); }
div#follow-toggle.closed { background-image: url('http://static.twitter.com/images/toggle_closed.gif'); }
div#follow-toggle.opened { background-image: url('http://static.twitter.com/images/toggle_opened.gif'); }
.follow-actions .following { background-image: url('http://static.twitter.com/images/checkmark.gif'); }
</style>
</head>
<body class="account ie" id="profile">
<div id="dim-screen"></div>
<ul id="accessibility">
<li>On a mobile phone? Check out <a href="http://m.twitter.com/">m.twitter.com</a>!</li>
<li><a href="#footer" accesskey="2">Skip to navigation</a></li>
<li><a href="#tabMenu" accesskey="3">Jump to the sidebar</a></li> <li><a href="#signin">Skip to sign in form</a></li>
</ul>
<div id="container" class="subpage">
<span id="loader" style="display:none"><img alt="Loader" src="http://assets0.twitter.com/images/loader.gif" /></span>
<h1 id="header">
<a href="/home" title="Twitter: home" accesskey="1">
<img alt="Twitter.com" height="41" src="http://assets1.twitter.com/images/twitter_logo_s.png" width="175" />
</a>
</h1>
<div id="flash" style="display:none;">
</div>
<div class="content-bubble-arrow"></div>
<table cellspacing="0" class="columns">
<tbody>
<tr>
<td id="content" class="column">
<div class="wrapper">
<div class="profile-head">
<h2 class="thumb">
<img alt="" class="profile-img" height="73" src="http://s3.amazonaws.com/twitter_production/profile_images/65319488/graffiti-istanbul_bigger.jpg" width="73" /> poecooper
</h2>
<div class="clear"></div>
<br />
<span class='sub-h1'>You need to send a request before you can start following this person.</span>
</td></tr></table>
<center>
<form action="friendships/create/17594015" method="post"><div style="margin:0;padding:0"><input name="authenticity_token" value="6c1729bbb0a192d52b7e01ff2653c232cfca4de8" /></div> name="commit" type="submit"
</div>
</div>
</td>
<td id="side_base" class="column">
<div id="side">
<div class="section">
<span class="section-links">
</ul>
</address>
<table class="stats" cellspacing="0">
<tr>
<td>
<a href="/poecooper/friends" id="following_count_link" rel="me">
<span id="following_count" class="stats_count numeric">1</span>
<br/>
<span class="label">Following</span>
</a>
</td>
<td>
<a href="/poecooper/followers" id="follower_count_link" rel="me">
<span id="follower_count" class="stats_count numeric">1</span>
<br/>
<span class="label">Followers</span>
</a>
</td><td>
<a href="/poecooper" rel="me"><span id="update_count" class="stats_count numeric">1</span><br/>
<span class="label">Updates</span></a>
</td>
</tr>
</table>
</div>
<ul id="tabMenu">
<li>
<a href="/poecooper" id="updates_tab">Updates</a> </li>
<li>
<a href="/poecooper/favourites" id="favorites_tab">Favorites</a> </li>
</ul>
<div class="section last">
<div class="section-header">
<h1>Actions</h1>
</div> <!-- /section-header -->
<ul>
<a href="/blocks/confirm/17594015" style="color: grey;">block</a> poecooper
</ul>
<br/>
<div class="section-header">
<h1>Following</h1>
</div>
<div id="friends">
<span class="vcard">
<a href="http://twitter.com/GratefulJen" class="url" rel="contact" title="GratefulJen"><img alt="GratefulJen" class="photo fn" height="24" src="http://s3.amazonaws.com/twitter_production/profile_images/65266377/photoshop-heart-brushes-21_mini.jpg" width="24" /></a>
</span>
</div>
<br/>
</div>
</div>
<hr />
</td>
</tr>
</tbody>
</table>
<div id="footer" >
<h3>Footer</h3>
<ul>
<li class="first">© 2009 Twitter</li>
<li><a href="/about#about">About Us</a></li>
<li><a href="/about#contact">Contact</a></li>
<li><a href="http://blog.twitter.com">Blog</a></li>
<li><a href="http://status.twitter.com">Status</a></li>
<li><a href="/downloads">Apps</a></li>
<li><a href="http://apiwiki.twitter.com/">API</a></li>
<li><a href="http://search.twitter.com">Search</a></li>
<li><a href="http://help.twitter.com">Help</a></li>
<li><a href="/jobs">Jobs</a></li>
<li><a href="/terms">Terms</a></li>
<li><a href="/privacy">Privacy</a></li>
</ul>
</div>
<hr />
<div id="navigation">
<ul>
<li class="first"><a href="http://twitter.com/home" id="home_link">Home</a></li>
<li><a href="http://twitter.com/biophylia" id="profile_link">Profile</a></li>
<li><a href="http://twitter.com/invitations" id="find_people_link">Find People</a></li>
<li><a href="/account/settings" id="settings_link">Settings</a></li>
<li><a href="http://help.twitter.com" id="help_link">Help</a></li>
<li><a id="sign_out_link" href="#" onclick="document.getElementById('sign_out_form').submit(); return false;">Sign out</a></li>
</ul>
<form method="post" id="sign_out_form" action="/sessions/destroy" style="display:none;">
<input name="authenticity_token" value="6c1729bbb0a192d52b7e01ff2653c232cfca4de8"
</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js" type="text/javascript"></script><script src="http://assets1.twitter.com/javascripts/application.js?1233275775" type="text/javascript"></script><script type="text/javascript">
//<![CDATA[
twttr.form_authenticity_token = '6c1729bbb0a192d52b7e01ff2653c232cfca4de8';
//]]>
</script><script type="text/javascript">
//<![CDATA[
$( function () {
$('body#profile ul#tabMenu li a#updates_tab, body#favourings ul#tabMenu li a#favorites_tab').isSidebarTab();
});
//]]>
</script>
<!-- BEGIN google analytics -->
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-30775-6");
pageTracker._setDomainName("twitter.com");
url = '/profile/poecooper';
pageTracker._setVar('Logged In');
pageTracker._setVar('lang: en_US');
pageTracker._trackPageview(url);
</script>
<!-- END google analytics -->
</body>
</html>
Untitled JavaScript (30-Jan @ 05:34)
Syntax Highlighted Code
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
- [280 more lines...]
Plain Code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<meta content="en-us" http-equiv="Content-Language" />
<meta content="Twitter is a free social messaging utility for staying connected in real-time" name="description" />
<meta content="no" http-equiv="imagetoolbar" />
<meta content="width = 780" name="viewport" />
<meta content="4FTTxY4uvo0RZTMQqIyhh18HsepyJOctQ+XTOu1zsfE=" name="verify-v1" />
<meta content="y" name="session-loggedin" />
<meta content="19577182" name="session-userid" />
<meta content="biophylia" name="session-user-screen_name" />
<meta content="poecooper" name="page-user-screen_name" />
<title>Twitter / poecooper</title>
<link href="http://assets1.twitter.com/images/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<link href="http://assets1.twitter.com/images/twitter_57.png" rel="apple-touch-icon" />
<link href="http://assets2.twitter.com/stylesheets/screen.css?1233275810" media="screen, projection" rel="stylesheet" type="text/css" />
<link href="http://assets2.twitter.com/stylesheets/master.css?1233275806" media="screen, projection" rel="stylesheet" type="text/css" />
<link href="http://assets2.twitter.com/stylesheets/ie.css?1233275807" media="screen, projection" rel="stylesheet" type="text/css" />
<style type="text/css">
body { background: #9ae4e8 url(http://assets2.twitter.com/images/bg.gif) fixed no-repeat top left; }
div.content-bubble-arrow { margin-top: 6px; padding-top: 11px; background: url(http://static.twitter.com/images/arr2.gif) no-repeat 25px 0px; }
.status-btn input.round-btn { background: url('http://static.twitter.com/images/round-btn.gif'); }
.status-btn input.round-btn:hover { background: url('http://static.twitter.com/images/round-btn-hover.gif'); }
.status-btn input.disabled, .status-btn input.disabled:hover { background: url('http://static.twitter.com/images/round-btn.gif'); }
.hentry .actions .fav { background-image: url('http://static.twitter.com/images/icon_star_full.gif'); }
.hentry .actions .non-fav { background-image: url('http://static.twitter.com/images/icon_star_empty.gif'); }
.hentry .actions .fav-throb, .hentry .actions a.del-throb { background-image: url('http://static.twitter.com/images/icon_throbber.gif'); }
.hentry .actions .del { background-image: url('http://static.twitter.com/images/icon_trash.gif'); }
body#show .repl, .hentry .actions .repl { background-image: url('http://static.twitter.com/images/icon_reply.gif'); }
.direct_message .actions .repl { background-image: url('http://static.twitter.com/images/icon_direct_reply.gif'); }
.direct_message .actions .del { background-image: url('http://static.twitter.com/images/icon_trash.gif'); }
.notify { background-image: url('http://static.twitter.com/images/girl.gif'); }
.promotion, ul#tabMenu a#keyword_search_tab.hover, ul#tabMenu a:hover { background-image: url('http://static.twitter.com/images/pale.png'); }
div#follow-toggle.closed { background-image: url('http://static.twitter.com/images/toggle_closed.gif'); }
div#follow-toggle.opened { background-image: url('http://static.twitter.com/images/toggle_opened.gif'); }
.follow-actions .following { background-image: url('http://static.twitter.com/images/checkmark.gif'); }
</style>
</head>
<body class="account ie" id="profile">
<div id="dim-screen"></div>
<ul id="accessibility">
<li>On a mobile phone? Check out <a href="http://m.twitter.com/">m.twitter.com</a>!</li>
<li><a href="#footer" accesskey="2">Skip to navigation</a></li>
<li><a href="#tabMenu" accesskey="3">Jump to the sidebar</a></li> <li><a href="#signin">Skip to sign in form</a></li>
</ul>
<div id="container" class="subpage">
<span id="loader" style="display:none"><img alt="Loader" src="http://assets0.twitter.com/images/loader.gif" /></span>
<h1 id="header">
<a href="/home" title="Twitter: home" accesskey="1">
<img alt="Twitter.com" height="41" src="http://assets1.twitter.com/images/twitter_logo_s.png" width="175" />
</a>
</h1>
<div id="flash" style="display:none;">
</div>
<div class="content-bubble-arrow"></div>
<table cellspacing="0" class="columns">
<tbody>
<tr>
<td id="content" class="column">
<div class="wrapper">
<div class="profile-head">
<h2 class="thumb">
<img alt="" class="profile-img" height="73" src="http://s3.amazonaws.com/twitter_production/profile_images/65319488/graffiti-istanbul_bigger.jpg" width="73" /> poecooper
</h2>
<div class="clear"></div>
<div class="protected-box">
<table><tr><td><br /><img alt="Padlock_large" src="http://assets3.twitter.com/images/padlock_large.gif" /></td>
<td><h1>This person has protected their updates.</h1>
<br />
<span class='sub-h1'>You need to send a request before you can start following this person.</span>
</td></tr></table>
<center>
<form action="friendships/create/17594015" method="post"><div style="margin:0;padding:0"><input name="authenticity_token" type="hidden" value="6c1729bbb0a192d52b7e01ff2653c232cfca4de8" /></div> <input id="send_request" name="commit" type="submit" value="Send request" />
</form>
</center><br />
</div>
</div>
</div>
</td>
<td id="side_base" class="column">
<div id="side">
<div class="section">
<span class="section-links">
<img src="http://assets0.twitter.com/images/icon_lock_sidebar.gif" title="This user’s updates are protected."/>
</span>
<address>
<ul class="about vcard entry-author">
<li><span class="label">Name</span> <span class="fn">poecooper</span></li>
</ul>
</address>
<table class="stats" cellspacing="0">
<tr>
<td>
<a href="/poecooper/friends" id="following_count_link" rel="me">
<span id="following_count" class="stats_count numeric">1</span>
<br/>
<span class="label">Following</span>
</a>
</td>
<td>
<a href="/poecooper/followers" id="follower_count_link" rel="me">
<span id="follower_count" class="stats_count numeric">1</span>
<br/>
<span class="label">Followers</span>
</a>
</td><td>
<a href="/poecooper" rel="me"><span id="update_count" class="stats_count numeric">1</span><br/>
<span class="label">Updates</span></a>
</td>
</tr>
</table>
</div>
<ul id="tabMenu">
<li>
<a href="/poecooper" id="updates_tab">Updates</a> </li>
<li>
<a href="/poecooper/favourites" id="favorites_tab">Favorites</a> </li>
</ul>
<div class="section last">
<div class="section-header">
<h1>Actions</h1>
</div> <!-- /section-header -->
<ul>
<a href="/blocks/confirm/17594015" style="color: grey;">block</a> poecooper
</ul>
<br/>
<div class="section-header">
<h1>Following</h1>
</div>
<div id="friends">
<span class="vcard">
<a href="http://twitter.com/GratefulJen" class="url" rel="contact" title="GratefulJen"><img alt="GratefulJen" class="photo fn" height="24" src="http://s3.amazonaws.com/twitter_production/profile_images/65266377/photoshop-heart-brushes-21_mini.jpg" width="24" /></a>
</span>
</div>
<br/>
</div>
</div>
<hr />
</td>
</tr>
</tbody>
</table>
<div id="footer" >
<h3>Footer</h3>
<ul>
<li class="first">© 2009 Twitter</li>
<li><a href="/about#about">About Us</a></li>
<li><a href="/about#contact">Contact</a></li>
<li><a href="http://blog.twitter.com">Blog</a></li>
<li><a href="http://status.twitter.com">Status</a></li>
<li><a href="/downloads">Apps</a></li>
<li><a href="http://apiwiki.twitter.com/">API</a></li>
<li><a href="http://search.twitter.com">Search</a></li>
<li><a href="http://help.twitter.com">Help</a></li>
<li><a href="/jobs">Jobs</a></li>
<li><a href="/terms">Terms</a></li>
<li><a href="/privacy">Privacy</a></li>
</ul>
</div>
<hr />
<div id="navigation">
<ul>
<li class="first"><a href="http://twitter.com/home" id="home_link">Home</a></li>
<li><a href="http://twitter.com/biophylia" id="profile_link">Profile</a></li>
<li><a href="http://twitter.com/invitations" id="find_people_link">Find People</a></li>
<li><a href="/account/settings" id="settings_link">Settings</a></li>
<li><a href="http://help.twitter.com" id="help_link">Help</a></li>
<li><a id="sign_out_link" href="#" onclick="document.getElementById('sign_out_form').submit(); return false;">Sign out</a></li>
</ul>
<form method="post" id="sign_out_form" action="/sessions/destroy" style="display:none;">
<input name="authenticity_token" value="6c1729bbb0a192d52b7e01ff2653c232cfca4de8" type="hidden" />
</form>
</div>
</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js" type="text/javascript"></script><script src="http://assets1.twitter.com/javascripts/application.js?1233275775" type="text/javascript"></script><script type="text/javascript">
//<![CDATA[
twttr.form_authenticity_token = '6c1729bbb0a192d52b7e01ff2653c232cfca4de8';
//]]>
</script><script type="text/javascript">
//<![CDATA[
$( function () {
$('body#profile ul#tabMenu li a#updates_tab, body#favourings ul#tabMenu li a#favorites_tab').isSidebarTab();
});
//]]>
</script>
<!-- BEGIN google analytics -->
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-30775-6");
pageTracker._setDomainName("twitter.com");
url = '/profile/poecooper';
pageTracker._setVar('Logged In');
pageTracker._setVar('lang: en_US');
pageTracker._trackPageview(url);
</script>
<!-- END google analytics -->
</body>
</html>
Untitled JavaScript (22-Jan @ 16:41)
Syntax Highlighted Code
- //DEFINIZIONE DI VARIABILI GLOBALI
- var dati_array_immobili ="";
- [402 more lines...]
Plain Code
//DEFINIZIONE DI VARIABILI GLOBALI
var dati_array_immobili ="";
var idimmobilemax=10000;
var idimmobilemin=0;
var abitativa_commerciale =0;
//questa function serve per settare il codice cliente
function setClienteinBox(array_clienti_id) {
document.getElementById("dati_del_proprietario").innerHTML = d_ric_cliente[array_clienti_id+1];
document.getElementById("immobilenew_idcliente").setAttribute( "value", d_ric_cliente[array_clienti_id] )
}
$(document).ready(function() {
/************************************************
//attributi iniziali //
*************************************************/
$("#makepdf").wrap("<a href='pdf.php?idimmobile="+idimmobile+"'>");
$("#wiz1").show();
$("#riferimento").html("Rif. "+idimmobile);
$("#navigation").show();
$("#ricerca_cliente").hide();
$("#immobilenew_pubblicita").val('');
$("#tabella_info_aggiuntive").slideUp("fast");
$("#tabella_finiture").slideUp("fast");
//Definisci i TOOLTIP
$('#navigation *').tooltip({
showURL: false
});
$('#wiz1 *').tooltip({
showURL: false
});
$.ajax({
type: "GET",
dataType: "text",
url: "handler_abitativo.php",
data: "action=getidimmobilemax",
success: function(text){
dati_array_idimm = text.split("#");
idimmobilemax=$.trim(dati_array_idimm[0]);
idimmobilemin=$.trim(dati_array_idimm[1]);
}
});
$("#latitudineLongitudine").click(function() {
tempIndirizzo = $("#immobilenew_indirizzo").val();
$("#container").html("");
$("#container").load('div/definisciMappa.php',function() {
$.getScript("js/gestioneMappa.js");
$("#mappa_indirizzo_transfer").attr("value",tempIndirizzo);
})
})
//GESTIONE MAPPE END
//associa il datepicker al suo input box
//ed imponi al DP la scelta solo per date future e non pregresse
$.datepicker.regional['it'];
$('#immobilenew_data_scad_incarico').datepicker({
dateFormat: "yy-mm-dd",
showOn: "both",
buttonImage: "../images/calendar.gif",
buttonImageOnly: true
});
//associa il datepicker al suo input box
//ed imponi al DP la scelta solo per date future e non pregresse
$.datepicker.regional['it'];
$('#immobilenew_data_verifica').datepicker({
dateFormat: "yy-mm-dd",
showOn: "both",
buttonImage: "../images/calendar.gif",
buttonImageOnly: true
});
//format number
$("#immobilenew_vendita_valore").floatnumber(".",2);
$("#immobilenew_vendita_trattabilita").floatnumber(".",2);
$("#immobilenew_affitto_valore").floatnumber(".",2);
$("#immobilenew_affitto_trattabilita").floatnumber(".",2);
//combo select editabili
$('#immobile_agente_segnalatore').editableCombobox();
/*************************************************************************************
//autocompletamento comune
*************************************************************************************/
$("#clientenew_comune").change(function () {
comune = $("#clientenew_comune").val();
$.ajax({
type: "GET",
dataType: "text",
url: "../_util/provincia_form/provinciaform_id.php",
data: "comune="+comune,
success: function(text){
text = $.trim(text);
comuni_province_array = text.split("#");
$("#clientenew_comune").val(comuni_province_array[0]);
$("#clientenew_provincia").val(comuni_province_array[2]);
$("#clientenew_cap").val(comuni_province_array[1]);
$("#clientenew_idcomune").val(comuni_province_array[3]);
$.ajax({
type: "GET",
dataType: "text",
url: "../_util/frazione_from/frazione_id.php",
data: "comune="+comuni_province_array[3],
success: function(text){
text = $.trim(text);
comuni_province_array = text.split("#");
$("#clientenew_idfrazione").html("");
for(i=0;i<comuni_province_array.length-1;i++) {
if(i%2==0){
$("#clientenew_idfrazione").append("<option value='"+comuni_province_array[i]+"' >"+comuni_province_array[i+1]+"</option>");
}
}
$("#clientenew_idfrazione").val(dati_array_immobili[4]);
},
error : function (XMLHttpRequest, textStatus, errorThrown) {
// typically only one of textStatus or errorThrown
// will have info
alert("error"); // the options for this ajax request
}
});
},
error : function (XMLHttpRequest, textStatus, errorThrown) {
// typically only one of textStatus or errorThrown
// will have info
alert("error"); // the options for this ajax request
}
});
});
$("#_close_dettagli").click(function(event) {
//alert("click");
event.preventDefault();
if (($("#_close_dettagli").attr("src"))=="../../../images/icons/png32/up16.png") {
$("#tabella_finiture").slideUp("normal");
$("#_close_dettagli").attr("src","../../../images/icons/png32/down16.png");
} else {
$("#tabella_finiture").slideDown("normal");
$("#_close_dettagli").attr("src","../../../images/icons/png32/up16.png");
}
});
$("#_close_dettagli_ulteriori_info").click(function(event) {
//alert("click");
event.preventDefault();
if (($("#_close_dettagli_ulteriori_info").attr("src"))=="../../../images/icons/png32/up16.png") {
$("#tabella_info_aggiuntive").slideUp("normal");
$("#_close_dettagli_ulteriori_info").attr("src","../../../images/icons/png32/down16.png");
} else {
$("#tabella_info_aggiuntive").slideDown("normal");
$("#_close_dettagli_ulteriori_info").attr("src","../../../images/icons/png32/up16.png");
}
});
//attiva la funzione seleziona il proprietario
$("#start_select_proprietario").click(function(event) {
//#dati_del_proprietario
$('#ricerca_cliente').dialog({
modal: true,
draggable: true,
height : 300,
width:350,
resizable:true,
title: 'Cerca Cliente',
overlay: {
opacity: 0.5,
background: "black"
}
}).show();
event.preventDefault();
//$('#ricerca_cliente').show();
});
var g = {
clearfields: function () {
$(":text").val("0");
$(":checkbox").attr('checked',false);
},
populate: function () {
$.ajax({
type: "GET",
dataType: "text",
url: "handler_abitativo.php",
data: "action=geteditimmobile&idimmobile="+idimmobile,
success: function(text){
text = $.trim(text);
dati_array_immobili = text.split("#");
//DATI DA CARICARE
if(dati_array_immobili[0]==1){$("#immobilenew_vendita").attr('checked',true)}
if(dati_array_immobili[1]==1){$("#immobilenew_affitto").attr('checked',true)}
$("#immobilenew_indirizzo").val(dati_array_immobili[2]);
$("$clientenew_idcomune").val(dati_array_immobili[3]).change();
$("#clientenew_idfrazione").val(dati_array_immobili[4]).change();
$("#immobilenew_descrizione").val(dati_array_immobili[5]);
$("#immobilenew_tipo_0").val(dati_array_immobili[6]).change();
$("#immobilenew_subtipo_0").val(dati_array_immobili[7]);
if(dati_array_immobili[8]==1){$("#immobilenew_compravenditaiva").attr('checked',true)}
$("#immobilenew_note").val(dati_array_immobili[9]);
$("#immobilenew_finiture_interne").val(dati_array_immobili[10]);
$("#immobilenew_finiture_esterne").val(dati_array_immobili[11]);
$("#immobilenew_disponibilita").val(dati_array_immobili[12]);
$("#immobilenew_spese").val(dati_array_immobili[13]);
$("#immobilenew_visita").val(dati_array_immobili[14]);
$("#immobile_agente").val(dati_array_immobili[15]).change();
$("#immobile_agente_segnalatore").val(dati_array_immobili[16]);
$("#immobile_agente_compilatore").val(dati_array_immobili[17]);
if(dati_array_immobili[18]==1){$("#immobilenew_mandato").attr('checked',true)}
$("#immobilenew_notemandato").val(dati_array_immobili[19]);
$("#immobilenew_mq_commli").val(dati_array_immobili[20]);
$("#immobilenew_mq_calpestabili").val(dati_array_immobili[21]);
$("#immobilenew_pubblicita").val(dati_array_immobili[22]);
$("#immobilenew_idcliente").val(dati_array_immobili[23]);
//ora stampa di dati del cliente
$.ajax({
type: "GET",
dataType: "text",
url: "handler.php",
data: "action=getcliente4firstsearch&idcliente="+$("#immobilenew_idcliente").val(),
success: function(text){
$("#dati_del_proprietario").html($.trim(text));
}
});
$("#immobilenew_data_verifica").val(dati_array_immobili[24]);
$("#immobilenew_data_inserimento").val(dati_array_immobili[25]);
$("#immobilenew_data_scad_incarico").val(dati_array_immobili[26]);
//DATI DA INSERISE NELLE SPECIFICHE TABELLE --> IMMOBILI_ABITATIVI / IMMOBILI_COMMERCIALI
$("#immobilenew_anno_costruzione").val(dati_array_immobili[27]);
$("#immobilenew_vendita_valore").val(dati_array_immobili[28]);
$("#immobilenew_vendita_trattabilita").val(dati_array_immobili[29]);
$("#immobilenew_affitto_valore").val(dati_array_immobili[30]);
$("#immobilenew_affitto_trattabilita").val(dati_array_immobili[31]);
if(dati_array_immobili[32]==1){$("#immobilenew_nuovo").attr('checked',true)}
if(dati_array_immobili[33]==1){$("#immobilenew_da_ristrutturare").attr('checked',true)}
if(dati_array_immobili[34]==1){$("#immobilenew_piantine").attr('checked',true)}
//if(dati_array_immobili[35]==1){$("#immobilenew_garage").attr('checked',true)}
$("#immobilenew_garage").val(dati_array_immobili[35]);
if(dati_array_immobili[36]==1){$("#immobilenew_chiavi").attr('checked',true)}
if(dati_array_immobili[37]==1){$("#immobilenew_luce").attr('checked',true)}
if(dati_array_immobili[38]==1){$("#immobilenew_ascensore").attr('checked',true)}
$("#immobilenew_bagni").val(dati_array_immobili[39]);
$("#immobilenew_vani").val(dati_array_immobili[40]);
$("#immobilenew_piano").val(dati_array_immobili[41]);
if(dati_array_immobili[42]==1){$("#immobilenew_risc_aut").attr('checked',true)}
if(dati_array_immobili[43]==1){$("#immobilenew_peep").attr('checked',true)}
if(dati_array_immobili[44]==1){$("#immobilenew_cantina").attr('checked',true)}
if(dati_array_immobili[45]==1){$("#immobilenew_palazzina").attr('checked',true)}
if(dati_array_immobili[46]==1){$("#immobilenew_ultimo").attr('checked',true)}
if(dati_array_immobili[47]==1){$("#immobilenew_balcone").attr('checked',true)}
if(dati_array_immobili[48]==1){$("#immobilenew_terrazzo").attr('checked',true)}
$("#immobilenew_mq_terrazzo").val(dati_array_immobili[49]);
$("#immobilenew_giardino").val(dati_array_immobili[50]);
if(dati_array_immobili[50]==1){$("#immobilenew_giardino").attr('checked',true)}
$("#immobilenew_mq_giardino").val(dati_array_immobili[51]);
$("#immobilenew_letti").val(dati_array_immobili[52]);
$("#clientenew_comune").val(dati_array_immobili[53]).change();
if (dati_array_immobili[54]!=0&&dati_array_immobili[55]!=0) {
$("#latitudineLongitudine").attr("src","../../../images/icons/png32/weboptions24.png");
$("#latitudineLongitudine").attr("title","Zona configurata correttamente");
}
}
});
}
};
$.ajax({
type: "GET",
dataType: "text",
url: "handler.php",
data: "action=carica_agenti&idimmobile="+idimmobile,
success: function(text){
text = $.trim(text);
$("#immobile_agente").html($("#immobile_agente").html()+text);
$("#immobile_agente_segnalatore").html($("#immobile_agente_segnalatore").html()+text);
$("#immobile_agente_compilatore").html($("#immobile_agente_compilatore").html()+text);
g.populate(); //richiama la funziona populate per riempire i campi
}
});
/*************************************************************************************
//gestisci gli eventi SUBMIT
*************************************************************************************/
$("#form1").submit( function(event) {
//effettua il submit solo se i campi sono stati compilati corretamente
if (validaForm.controlla()) {
//configura dati form1
input = "&idimmobile="+idimmobile+"&immobilenew_tipologia_ab_com=0&immobilenew_idcliente="+$("#immobilenew_idcliente").val() +"&immobile_tipo="+$("#immobilenew_tipo_0").val() +"&immobilenew_subtipo="+$("#immobilenew_subtipo_0").val();
input = input + "&immobilenew_vendita="+$("#immobilenew_vendita").attr('checked') +"&immobilenew_affitto="+$("#immobilenew_affitto").attr('checked') +"&immobilenew_indirizzo="+$("#immobilenew_indirizzo").val();
input = input + "&clientenew_idcomune="+$("#clientenew_idcomune").val() +"&clientenew_idfrazione="+$("#clientenew_idfrazione").val()+"&immobilenew_vendita_valore="+$("#immobilenew_vendita_valore").val();
input = input + "&immobilenew_vendita_trattabilita="+$("#immobilenew_vendita_trattabilita").val() +"&immobilenew_affitto_valore="+$("#immobilenew_affitto_valore").val();
input = input + "&immobilenew_affitto_trattabilita="+$("#immobilenew_affitto_trattabilita").val() +"&immobilenew_descrizione="+$("#immobilenew_descrizione").val();
input = input + "&immobilenew_pubblicita="+$("#immobilenew_pubblicita").val() +"&immobilenew_note="+$("#immobilenew_note").val();
input = input + "&immobilenew_finiture_interne="+$("#immobilenew_finiture_interne").val() +"&immobilenew_finiture_esterne="+$("#immobilenew_finiture_esterne").val();
input = input + "&immobilenew_nuovo="+$("#immobilenew_nuovo").attr('checked')+"&immobilenew_piantine="+$("#immobilenew_piantine").attr('checked');
input = input + "&immobilenew_letti="+$("#immobilenew_letti").val() +"&immobilenew_mq_commli="+$("#immobilenew_mq_commli").val();
input = input + "&immobilenew_da_ristrutturare="+$("#immobilenew_da_ristrutturare").attr('checked') +"&immobilenew_bagni="+$("#immobilenew_bagni").val();
input = input + "&immobilenew_mq_calpestabili="+$("#immobilenew_mq_calpestabili").val() + "&immobilenew_peep="+$("#immobilenew_peep").attr('checked');
input = input + "&immobilenew_chiavi="+$("#immobilenew_chiavi").attr('checked')+ "&immobilenew_vani="+$("#immobilenew_vani").val()+ "&immobilenew_anno_costruzione="+$("#immobilenew_anno_costruzione").val();
input = input + "&immobilenew_ascensore="+$("#immobilenew_ascensore").attr('checked')+"&immobilenew_luce="+$("#immobilenew_luce").attr('checked') +"&immobilenew_garage="+$("#immobilenew_garage").val();
input = input + "&immobilenew_cantina="+$("#immobilenew_cantina").attr('checked') +"&immobilenew_balcone="+$("#immobilenew_balcone").attr('checked')+"&immobilenew_piano="+$("#immobilenew_piano").val();
input = input + "&immobilenew_terrazzo="+$("#immobilenew_terrazzo").attr('checked')+"&immobilenew_mq_terrazzo="+$("#immobilenew_mq_terrazzo").val()+"&immobilenew_ultimo="+$("#immobilenew_ultimo").attr('checked');
input = input + "&immobilenew_giardino="+$("#immobilenew_giardino").attr('checked') +"&immobilenew_mq_giardino="+$("#immobilenew_mq_giardino").val()+"&immobile_agente="+$("#immobile_agente").val();
input = input + "&immobile_agente_segnalatore="+$("#immobile_agente_segnalatore").val() +"&immobile_agente_compilatore="+$("#immobile_agente_compilatore").val()+"&immobilenew_spese="+$("#immobilenew_spese").val();
input = input + "&immobilenew_disponibilita="+$("#immobilenew_disponibilita").val() + "&immobilenew_visita="+$("#immobilenew_visita").val() +"&immobilenew_mandato="+$("#immobilenew_mandato").attr('checked')+"&immobilenew_notemandato="+$("#immobilenew_notemandato").val()
input = input + "&immobilenew_data_scad_incarico="+$("#immobilenew_data_scad_incarico").val()+ "&immobilenew_data_inserimento="+$("#immobilenew_data_inserimento").val();
input = input + "&immobilenew_data_verifica="+$("#immobilenew_data_verifica").val();
input = input + "&immobilenew_palazzina="+$("#immobilenew_palazzina").attr('checked')+ "&immobilenew_risc_aut="+$("#immobilenew_risc_aut").attr('checked')+ "&immobilenew_venditaiva="+$("#immobilenew_venditaiva").attr('checked');
//alert(input);
$.ajax({
type: "POST",
dataType: "text",
url: "handler_abitativo.php",
data: "action=editimmobile"+input,
success: function(text){
esito = $.trim(text) ;
if (esito==1) {
alert("Modifiche apportate con Successo!");
} else {
alert("Errore nella registrazione delle informazioni.. operazione annullata!");
}
}
});
}
return false;
});
/************************************************************************************************************************************************************
DIV NAVIGAZIONE Ver. 0.1
************************************************************************************************************************************************************/
$("#navigation *").click(function(){
action=$(this).attr('id');
if (action=="makepdf") {
}
if (action=="gotofirst") {
if (idimmobile!=idimmobilemin) {
idimmobile=idimmobilemin;
g.clearfields();
g.populate();
}
}
if (action=="gotoback") {
if(idimmobile!=idimmobilemin) {
$.ajax({
type: "GET",
dataType: "text",
url: "handler_abitativo.php",
data: "action=getidpreviousrow&idimmobile="+idimmobile,
success: function(text){
esito = $.trim(text) ;
idimmobile=esito;
g.clearfields();
g.populate();
}
});
}
}
if (action=="gotonext") {
if (idimmobile<idimmobilemax) {
$.ajax({
type: "GET",
dataType: "text",
url: "handler_abitativo.php",
data: "action=getidnextrow&idimmobile="+idimmobile,
success: function(text){
esito = $.trim(text) ;
idimmobile=esito;
g.clearfields();
g.populate();
}
});
}
}
if (action=="gotoforward") {
if (idimmobile!=idimmobilemax) {
idimmobile=idimmobilemax;
g.clearfields();
g.populate();
}
}
});
/************************************************************************************************************************************************************/
});
Untitled JavaScript (22-Jan @ 16:40)
Syntax Highlighted Code
- $.ajax({
- type: "GET",
- dataType: "text",
- url: "handlerrichiesta.php",
- [8 more lines...]
Plain Code
$.ajax({
type: "GET",
dataType: "text",
url: "handlerrichiesta.php",
data: "action=printPreferiti",
success: function(text){
list = text.split(",");
for(i=0;i<list.length;i++) {
$("#preferitiaggiunti").append("<option value="+list[i]+">rif."+list[i]+"</option>");
}
}
});
Untitled JavaScript (20-Jan @ 15:23)
Syntax Highlighted Code
- $("#dialog")
- .dialog()
- .parents('.ui-dialog').find('.ui-dialog-titlebar')
- .append($('<span>_</span>')
- [9 more lines...]
Plain Code
$("#dialog")
.dialog()
.parents('.ui-dialog').find('.ui-dialog-titlebar')
.append($('<span>_</span>')
.click(function() {
alert('minimize');
})
)
.append($('<span>^</span>')
.click(function() {
alert('maximize');
})
);
Untitled JavaScript (19-Jan @ 10:03)
Syntax Highlighted Code
- /
- 8
- 9
- 10 $(document).ready(function () {
- [43 more lines...]
Plain Code
/
8
9
10 $(document).ready(function () {
11
12 // detect link to subpage
13 var host = window.location.host;
14 var URI = location.href.replace(/#.*/,'');//local url without hash
15 var currentlocation = URI.split('/').pop();
16
17 if(currentlocation && $.inArray('#',window.location.href.split('/').pop())){
18 document.location.replace('http://'+host+'/#'+currentlocation);
19 return;
20 }
21
22 var a_uris = [];
23 var $navigationitems = $('#navigatie a');
24 var nrOfItems=$navigationitems.size();
25
26 $navigationitems.each(function(list){
27 a_uris.push(this.href);
28
29 var s_url = this.href + '/ajax';
30
31 // Change url to anchor
32 this.href = '#' + this.href.split('/').pop();
33
34 if(list>0){
35
36 jQuery.ajaxQueue({
37 url: s_url,
38 success: function(html){
39 $("#scrollContainer").append(html);
40 if(list==nrOfItems-1){
41 $.getScript("js/coda-slider.js");
42 $.getScript("js/photobook.js");
43 $.getScript("js/projectgallery.js");
44 }
45
46 }
47 });
48 }
49
50 });
51
52 });
53
Untitled JavaScript (15-Jan @ 00:12)
Syntax Highlighted Code
- document.getElementById("hello").innerHTML = "Can't be fucked.<br>Literally, Paul";
Plain Code
document.getElementById("hello").innerHTML = "Can't be fucked.<br>Literally, Paul";
Untitled JavaScript (14-Jan @ 00:40)
Syntax Highlighted Code
- // handle IE 6
- if ($.browser.msie && $.browser.version < 7) {
- var scrollHeight = Math.max(
- document.documentElement.scrollHeight,
- [15 more lines...]
Plain Code
// handle IE 6
if ($.browser.msie && $.browser.version < 7) {
var scrollHeight = Math.max(
document.documentElement.scrollHeight,
document.body.scrollHeight
);
var offsetHeight = Math.max(
document.documentElement.offsetHeight,
document.body.offsetHeight
);
if (scrollHeight < offsetHeight) {
return $(window).height() + 'px';
} else {
return scrollHeight + 'px';
}
// handle "good" browsers
} else {
return $(document).height() + 'px';
}
not in selector (14-Jan @ 00:11)
Syntax Highlighted Code
- jQuery.extend(jQuery.expr[":"], {
- notin: function (a, b, m) {
- return !!!jQuery(a).parents(m[3]).length;
- }
- });
Plain Code
jQuery.extend(jQuery.expr[":"], {
notin: function (a, b, m) {
return !!!jQuery(a).parents(m[3]).length;
}
});
Untitled JavaScript (13-Jan @ 23:39)
Syntax Highlighted Code
- $(document).ready(function() {
- var log = alert;
- $('body')
- .bind('test.a', function() {
- [25 more lines...]
Plain Code
$(document).ready(function() {
var log = alert;
$('body')
.bind('test.a', function() {
log('.a');
})
.bind('test.b', function() {
log('.b');
})
.bind('test.a.b', function() {
log('.a.b');
})
.bind('test.a test.b', function() {
log('.a .b');
});
$('<button/>')
.appendTo('body')
.text('a')
.click(function() {
$('body').trigger('test.a');
});
$('<button/>')
.appendTo('body')
.text('b')
.click(function() {
$('body').trigger('test.b');
});
});
Filter where parent isn't (13-Jan @ 16:22)
Syntax Highlighted Code
- $('tag').parents(':not(selector)').find('> tag')
Plain Code
$('tag').parents(':not(selector)').find('> tag')
Untitled JavaScript (13-Jan @ 15:27)
Syntax Highlighted Code
- $("a.tooltip").hover(
- function(e) {
- tooltipText = $(this).children("img").attr("alt");
- if ($.browser.msie) $(this).children("img").attr("alt", "");
- [14 more lines...]
Plain Code
$("a.tooltip").hover(
function(e) {
tooltipText = $(this).children("img").attr("alt");
if ($.browser.msie) $(this).children("img").attr("alt", "");
$("body").append("<div id='tooltip'><p>" + tooltipText + "</p></div>");
positionTooltip(e.pageX, e.pageY);
$("#tooltip").fadeIn();
},
function() {
if ($.browser.msie) $(this).children("img").attr("alt", tooltipText);
$("#tooltip").remove();
});
$("a.tooltip").mousemove(function(e) {
positionTooltip(e.pageX, e.pageY);
});
function positionTooltip(pageX, pageY) {
$("#tooltip").css("left", (pageX - $("#tooltip").width() + 30) + "px").css("top", (pageY + 30) + "px");
}
Untitled JavaScript (7-Jan @ 09:05)
Syntax Highlighted Code
- function valid_job(job,type,statut,serveur)
- {
- var url="/desk/sauvegarde/valid_job.php";
- [12 more lines...]
Plain Code
function valid_job(job,type,statut,serveur)
{
var url="/desk/sauvegarde/valid_job.php";
//alert(job+" "+type+" "+statut+" "+serveur);
var ajax = new Ajax(url, {
method: "POST",
data: "job=" + job + "&type=" + type + "&statut=" + statut + "&serveur=" + serveur,
onComplete: function(msg) {
$("tab_job").innerHTML=msg;
}
onFailure: function() {
$("tab_job").innerHTML="test";
}
}).request();
}
Untitled JavaScript (2-Jan @ 22:00)
Syntax Highlighted Code
- _trigger: function(type, event, data) {
- var eventName = (type == this.widgetEventPrefix
- ? type : this.widgetEventPrefix + type),
- baseEvent = { type: eventName, target: this.element[0] };
- [6 more lines...]
Plain Code
_trigger: function(type, event, data) {
var eventName = (type == this.widgetEventPrefix
? type : this.widgetEventPrefix + type),
baseEvent = { type: eventName, target: this.element[0] };
event = $.extend(event || $.event.fix(baseEvent), baseEvent);
this.element.trigger(event, data);
var ret = (this.options[type] && this.options[type].call(this.element[0], event, data));
return !event.isDefaultPrevented() && ret !== false;
}
Untitled JavaScript (2-Jan @ 21:46)
Syntax Highlighted Code
- _trigger: function(type, event, data) {
- var eventName = (type == this.widgetEventPrefix
- ? type : this.widgetEventPrefix + type);
- [8 more lines...]
Plain Code
_trigger: function(type, event, data) {
var eventName = (type == this.widgetEventPrefix
? type : this.widgetEventPrefix + type);
event = event ? $.event.fix( event ) : jQuery.Event();
event.type = eventName;
this.element.trigger(event, data);
return !( this.options[type] &&
this.options[type].call(this.element[0], event, data) === false ||
event.isDefaultPrevented() );
}