code
stringlengths
1
2.08M
language
stringclasses
1 value
// Copyright 2006 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in wr...
JavaScript
// Copyright 2006 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in wr...
JavaScript
/** * Creates a new level control. * @constructor * @param {IoMap} iomap the IO map controller. * @param {Array.<string>} levels the levels to create switchers for. */ function LevelControl(iomap, levels) { var that = this; this.iomap_ = iomap; this.el_ = this.initDom_(levels); google.maps.event.addList...
JavaScript
// Copyright 2011 Google /** * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in wri...
JavaScript
/** * Creates a new Floor. * @constructor * @param {google.maps.Map=} opt_map */ function Floor(opt_map) { /** * @type Array.<google.maps.MVCObject> */ this.overlays_ = []; /** * @type boolean */ this.shown_ = true; if (opt_map) { this.setMap(opt_map); } } /** * @param {google.maps.M...
JavaScript
/** * @license * * Copyright 2011 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable l...
JavaScript
/* * Copyright (C) 2011 The Code Bakers * Authors: Gilmar Costa * e-mail: thecodebakers@gmail.com e gilmarcs@gmail.com * Project: https://code.google.com/p/open-source-android-blackjack/ * Site: http://thecodebakers.blogspot.com * * Licensed under the GNU GPL, Version 3.0 (the "License"); * you may not ...
JavaScript
/* * Copyright (C) 2011 The Code Bakers * Authors: Gilmar Costa * e-mail: thecodebakers@gmail.com e gilmarcs@gmail.com * Project: https://code.google.com/p/open-source-android-blackjack/ * Site: http://thecodebakers.blogspot.com * * Licensed under the GNU GPL, Version 3.0 (the "License"); * you may not ...
JavaScript
/* * Copyright (C) 2011 The Code Bakers * Authors: Gilmar Costa * e-mail: thecodebakers@gmail.com e gilmarcs@gmail.com * Project: https://code.google.com/p/open-source-android-blackjack/ * Site: http://thecodebakers.blogspot.com * * Licensed under the GNU GPL, Version 3.0 (the "License"); * you may not ...
JavaScript
/* * Copyright (C) 2011 The Code Bakers * Authors: Gilmar Costa * e-mail: thecodebakers@gmail.com e gilmarcs@gmail.com * Project: https://code.google.com/p/open-source-android-blackjack/ * Site: http://thecodebakers.blogspot.com * * Licensed under the GNU GPL, Version 3.0 (the "License"); * you may not ...
JavaScript
/* * Copyright (C) 2011 The Code Bakers * Authors: Gilmar Costa * e-mail: thecodebakers@gmail.com e gilmarcs@gmail.com * Project: https://code.google.com/p/open-source-android-blackjack/ * Site: http://thecodebakers.blogspot.com * * Licensed under the GNU GPL, Version 3.0 (the "License"); * you may not ...
JavaScript
/* * Copyright (C) 2011 The Code Bakers * Authors: Gilmar Costa * e-mail: thecodebakers@gmail.com e gilmarcs@gmail.com * Project: https://code.google.com/p/open-source-android-blackjack/ * Site: http://thecodebakers.blogspot.com * * Licensed under the GNU GPL, Version 3.0 (the "License"); * you may not ...
JavaScript
/* * Copyright (C) 2011 The Code Bakers * Authors: Gilmar Costa * e-mail: thecodebakers@gmail.com e gilmarcs@gmail.com * Project: https://code.google.com/p/open-source-android-blackjack/ * Site: http://thecodebakers.blogspot.com * * Licensed under the GNU GPL, Version 3.0 (the "License"); * you may not ...
JavaScript
/* * PhoneGap is available under *either* the terms of the modified BSD license *or* the * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text. * * Copyright (c) 2005-2010, Nitobi Software Inc. * Copyright (c) 2010, IBM Corporation */ /** * The order of events during page load an...
JavaScript
/* "URL-safe" Base64 Codec, by Jacob Rus This library happily strips off as many trailing '=' as are included in the input to 'decode', and doesn't worry whether its length is an even multiple of 4. It does not include trailing '=' in its own output. It uses the 'URL safe' base64 alphabet, where the last two character...
JavaScript
var sys = require('sys'); var fs = require('fs'); var http = require('http'); var url_parse = require("url").parse; var NOT_FOUND = "Not Found\n"; var routes = []; function notFound(req, res, message) { sys.debug("notFound!"); message = message || NOT_FOUND; res.sendHeader(404, [ ["Content-Type", "text/plain"],...
JavaScript
// Redis client for Node.js // Author: Brian Hammond <brian at fictorial dot com> // Copyright (C) 2009 Fictorial LLC // License: MIT var sys = require("sys"), tcp = require("tcp"); var crlf = "\r\n", crlf_len = 2; var inline_commands = { auth:1, bgsave:1, dbsize:1, decr:1, decrby:1, del:1, exists:1...
JavaScript
var http = require('http'); var multipart = require('multipart'); var redis = require("./redisclient"); var sys = require('sys'); var url = require('url'); var server = require('./node-router'); var base64 = require('./base64'); var fs = require("fs"); function logon(req, res, match) { var image=""; req.setBodyEnc...
JavaScript
/*! SWFObject v2.2 <http://code.google.com/p/swfobject/> is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> */ var swfobject = function() { var UNDEF = "undefined", OBJECT = "object", SHOCKWAVE_FLASH = "Shockwave Flash", SHOCKWAVE_FLASH_AX = "ShockwaveFlash.Shoc...
JavaScript
var total;//定义flash影片总桢数 var frame_number;//定义flash影片当前桢数 //以下是滚动条图片拖动程序 var dragapproved=false; var z,x,y var movie = document.getElementById('movie'); //动态显示播放影片的当前桢/总桢数(进度条显示) function showcount(){ //已测可用CallJava.consoleFlashProgress(5); total = movie.TotalFrames; frame_number=movie.CurrentFrame(...
JavaScript
/*! SWFObject v2.2 <http://code.google.com/p/swfobject/> is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> */ var swfobject = function() { var UNDEF = "undefined", OBJECT = "object", SHOCKWAVE_FLASH = "Shockwave Flash", SHOCKWAVE_FLASH_AX = "ShockwaveFlash.Shoc...
JavaScript
$("#page1").live("pageinit",function() { $("#btn_next1").bind("click", function() { Helper.hideHelper(); }); });
JavaScript
(function() { // Technique from Juriy Zaytsev // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/ function isEventSupported(eventName) { var el = document.createElement('div'); eventName = 'on' + eventName; var isSupported = (eventName in el); if (!isSuppor...
JavaScript
// Place your application-specific JavaScript functions and classes here // This file is automatically included by javascript_include_tag :defaults
JavaScript
function double_list_move(srcId, destId) { var src=document.getElementById(srcId); var dest=document.getElementById(destId); for (var i = 0; i < src.options.length; i++) { if (src.options[i].selected) { dest.options[dest.length] = new Option(src.options[i].text, src.options[i].value); src.o...
JavaScript
// django javascript file // Finds all fieldsets with class="collapse", collapses them, and gives each // one a "show" link that uncollapses it. The "show" link becomes a "hide" // link when the fieldset is visible. function findForm(node) { // returns the node of the form containing the given node if (node.tagNa...
JavaScript
// script.aculo.us unittest.js v1.8.2, Tue Nov 18 18:30:58 +0100 2008 // Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) // (c) 2005-2008 Jon Tirsen (http://www.tirsen.com) // (c) 2005-2008 Michael Schuerig (http://www.schuerig.de/michael/) // // script.aculo.us i...
JavaScript
// script.aculo.us slider.js v1.8.2, Tue Nov 18 18:30:58 +0100 2008 // Copyright (c) 2005-2008 Marty Haught, Thomas Fuchs // // script.aculo.us is freely distributable under the terms of an MIT-style license. // For details, see the script.aculo.us web site: http://script.aculo.us/ if (!Control) var Control = { }; /...
JavaScript
// script.aculo.us sound.js v1.8.2, Tue Nov 18 18:30:58 +0100 2008 // Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) // // Based on code created by Jules Gravinese (http://www.webveteran.com/) // // script.aculo.us is freely distributable under the terms of an MIT-style license. // ...
JavaScript
// script.aculo.us scriptaculous.js v1.8.2, Tue Nov 18 18:30:58 +0100 2008 // Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"),...
JavaScript
// script.aculo.us builder.js v1.8.2, Tue Nov 18 18:30:58 +0100 2008 // Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) // // script.aculo.us is freely distributable under the terms of an MIT-style license. // For details, see the script.aculo.us web site: http://script.aculo.us/ va...
JavaScript
// script.aculo.us unittest.js v1.8.2, Tue Nov 18 18:30:58 +0100 2008 // Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) // (c) 2005-2008 Jon Tirsen (http://www.tirsen.com) // (c) 2005-2008 Michael Schuerig (http://www.schuerig.de/michael/) // // script.aculo.us i...
JavaScript
// script.aculo.us slider.js v1.8.2, Tue Nov 18 18:30:58 +0100 2008 // Copyright (c) 2005-2008 Marty Haught, Thomas Fuchs // // script.aculo.us is freely distributable under the terms of an MIT-style license. // For details, see the script.aculo.us web site: http://script.aculo.us/ if (!Control) var Control = { }; /...
JavaScript
// script.aculo.us sound.js v1.8.2, Tue Nov 18 18:30:58 +0100 2008 // Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) // // Based on code created by Jules Gravinese (http://www.webveteran.com/) // // script.aculo.us is freely distributable under the terms of an MIT-style license. // ...
JavaScript
// script.aculo.us scriptaculous.js v1.8.2, Tue Nov 18 18:30:58 +0100 2008 // Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"),...
JavaScript
// script.aculo.us builder.js v1.8.2, Tue Nov 18 18:30:58 +0100 2008 // Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) // // script.aculo.us is freely distributable under the terms of an MIT-style license. // For details, see the script.aculo.us web site: http://script.aculo.us/ va...
JavaScript
// JavaScript Document //jquery timers /** * jQuery.timers - Timer abstractions for jQuery * Written by Blair Mitchelmore (blair DOT mitchelmore AT gmail DOT com) * Licensed under the WTFPL (http://sam.zoy.org/wtfpl/). * Date: 2009/10/16 * * @author Blair Mitchelmore * @version 1.2 * **/ jQuery...
JavaScript
/** * @name GeoClusterer * @version 1.0 * @author Huan Erdao * @copyright (c) 2009 Huan Erdao * @fileoverview * This javascript library comes from markerclusterer by Xiaoxi Wu * which partially ported to work with google maps v3 apis. */ /* * Licensed under the Apache License, Version 2.0 (the "Lic...
JavaScript
/* * StringBuffer class */ function StringBuffer() { this.buffer = []; } StringBuffer.prototype.append = function append (string) { this.buffer.push(string); return this; }; StringBuffer.prototype.toString = function toString () { return this.buffer.join(""); }; /* * Strip html tags */ function ...
JavaScript
/*! * jQuery Mobile v1.0b2 * http://jquerymobile.com/ * * Copyright 2010, jQuery Project * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license */ /*! * jQuery UI Widget @VERSION * * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Ver...
JavaScript
//quick view source in new window links $.fn.addSourceLink = function(style){ return $(this).each(function(){ var link = $('<a href="#" data-'+ $.mobile.ns +'inline="true">View Source</a>'), src = src = $('<div></div>').append( $(this).clone() ).html(), page = $( "<div data-"+ $.mobile.ns +"role='dialog' data...
JavaScript
//set up the theme switcher on the homepage $('div').live('pagecreate',function(event){ if( !$(this).is('.ui-dialog')){ var appendEl = $(this).find('.ui-footer:last'); if( !appendEl.length ){ appendEl = $(this).find('.ui-content'); } if( appendEl.is("[data-position]") ){ return; } $('<a hre...
JavaScript
/* * mobile button unit tests */ (function($){ $.mobile.page.prototype.options.keepNative = "button.should-be-native"; test( "button elements in the keepNative set shouldn't be enhanced", function() { same( $("button.should-be-native").siblings("div.ui-slider").length, 0 ); }); test( "button elements should b...
JavaScript
/* * mobile page unit tests */ (function($){ var libName = 'jquery.mobile.page.js'; module(libName); test( "nested header anchors aren't altered", function(){ ok(!$('.ui-header > div > a').hasClass('ui-btn')); }); test( "nested footer anchors aren't altered", function(){ ok(!$('.ui-footer > div > a').hasC...
JavaScript
/* * mobile textinput unit tests */ (function($){ module( "jquery.mobile.forms.textinput.js" ); test( "inputs without type specified are enhanced", function(){ ok( $( "#typeless-input" ).hasClass( "ui-input-text" ) ); }); $.mobile.page.prototype.options.keepNative = "textarea.should-be-native"; // not testi...
JavaScript
(function($) { asyncTest( "nested pages hash key is always in the hash on default page with no id (replaceState) ", function(){ $.testHelper.pageSequence([ function(){ // Click on the link of the third li element $('.ui-page-active li:eq(2) a:eq(0)').click(); }, function(){ ok( location.hash.se...
JavaScript
/* * mobile listview unit tests */ // TODO split out into seperate test files (function($){ var home = $.mobile.path.parseUrl( location.href ).pathname; $.mobile.defaultTransition = "none"; module( "Basic Linked list", { setup: function(){ $.testHelper.openPage( "#basic-linked-test" ); } }); asyncTes...
JavaScript
/* * mobile event unit tests */ (function($){ var libName = "jquery.mobile.event.js", absFn = Math.abs, originalEventFn = $.Event.prototype.originalEvent, preventDefaultFn = $.Event.prototype.preventDefault, events = ("touchstart touchmove touchend orientationchange tap taphold " + "swipe swipel...
JavaScript
/* * mobile dialog unit tests */ (function($){ module('jquery.mobile.fieldContain.js'); test( "Field container contains appropriate css styles", function(){ ok($('#test-fieldcontain').hasClass('ui-field-contain ui-body ui-br'), 'A fieldcontain element must contain styles "ui-field-contain ui-body ui-br"'); });...
JavaScript
/* * mobile buttonMarkup tests */ (function($){ module("jquery.mobile.buttonMarkup.js"); test( "control group buttons should be enhanced inside a footer", function(){ var group, linkCount; group = $("#control-group-footer"); linkCount = group.find( "a" ).length; same( group.find("a.ui-btn").length, linkC...
JavaScript
/* * mobile listview unit tests */ // TODO split out into seperate test files (function( $ ){ module( "Collapsible section", {}); asyncTest( "The page should enhanced correctly", function(){ $.testHelper.pageSequence([ function(){ $.testHelper.openPage( "#basic-collapsible-test" ); }, function() {...
JavaScript
// load testswarm agent (function() { var url = window.location.search; url = decodeURIComponent( url.slice( url.indexOf("swarmURL=") + 9 ) ); if ( !url || url.indexOf("http") !== 0 ) { return; } document.write("<scr" + "ipt src='http://swarm.jquery.org/js/inject.js?" + (new Date).getTime() + "'></scr" + "...
JavaScript
/* * mobile media unit tests */ (function($){ var cssFn = $.fn.css, widthFn = $.fn.width; // make sure original definitions are reset module('jquery.mobile.media.js', { setup: function(){ $(document).trigger('mobileinit.htmlclass'); }, teardown: function(){ $.fn.css = cssFn; $.fn.width = widthF...
JavaScript
/* * mobile page unit tests */ (function($){ var libName = 'jquery.mobile.page.sections.js', themedefault = $.mobile.page.prototype.options.theme, keepNative = $.mobile.page.prototype.options.keepNative; module(libName, { setup: function() { $.mobile.page.prototype.options.keepNative = keepNative; } })...
JavaScript
$(function() { var Runner = function( ) { var self = this; $.extend( self, { frame: window.frames[ "testFrame" ], testTimeout: 3 * 60 * 1000, $frameElem: $( "#testFrame" ), assertionResultPrefix: "assertion result for test:", onTimeout: QUnit.start, onFrameLoad: function() { // establis...
JavaScript
/* * mobile init tests */ (function($){ test( "page element is generated when not present in initial markup", function(){ ok( $( ".ui-page" ).length, 1 ); }); })(jQuery);
JavaScript
/* * mobile init tests */ (function($){ var mobilePage = undefined, libName = 'jquery.mobile.init.js', coreLib = 'jquery.mobile.core.js', extendFn = $.extend, setGradeA = function(value) { $.mobile.gradeA = function(){ return value; }; }, reloadCoreNSandInit = function(){ $.testHelper.reloadLib(co...
JavaScript
/* * mobile dialog unit tests */ (function($) { module( "jquery.mobile.dialog.js", { setup: function() { $.mobile.page.prototype.options.contentTheme = "d"; } }); asyncTest( "dialog hash is added when the dialog is opened and removed when closed", function() { expect( 2 ); $.testHelper.pageSequence([ ...
JavaScript
//set namespace for unit test markp $( document ).bind( "mobileinit", function(){ $.mobile.ns = "nstest-"; });
JavaScript
/* * mobile core unit tests */ (function($){ var libName = "jquery.mobile.core.js", setGradeA = function(value, version) { $.support.mediaquery = value; $.mobile.browser.ie = version; }, extendFn = $.extend; module(libName, { setup: function(){ // NOTE reset for gradeA tests $('html').rem...
JavaScript
/* * mobile core unit tests */ (function($){ var libName = "jquery.mobile.core.js", scrollTimeout = 20, // TODO expose timing as an attribute scrollStartEnabledTimeout = 150; module(libName, { setup: function(){ $("<div id='scroll-testing' style='height: 1000px'></div>").appendTo("body"); }, teard...
JavaScript
/* * mobile support unit tests */ $.testHelper.excludeFileProtocol(function(){ var prependToFn = $.fn.prependTo, libName = "jquery.mobile.support.js"; module(libName, { teardown: function(){ //NOTE undo any mocking $.fn.prependTo = prependToFn; } }); // NOTE following two tests have debatable valu...
JavaScript
/* * mobile navigation unit tests */ (function($){ var siteDirectory = location.pathname.replace(/[^/]+$/, ""); module('jquery.mobile.navigation.js', { setup: function(){ if ( location.hash ) { stop(); $(document).one("pagechange", function() { start(); } ); location.hash = ""; } } ...
JavaScript
/* * mobile navigation path unit tests */ (function($){ var url = $.mobile.path.parseUrl( location.href ), home = location.href.replace( url.domain, "" ); var testPageLoad = function(testPageAnchorSelector, expectedTextValue){ expect( 2 ); $.testHelper.pageSequence([ function(){ // reset before each ...
JavaScript
(function($) { asyncTest( "dialog ui-state should be part of the hash", function(){ $.testHelper.sequence([ function() { // open the test page $.mobile.activePage.find( "a" ).click(); }, function() { // verify that the hash contains the dialogHashKey ok( location.hash.search($.mobile.dialog...
JavaScript
/* * mobile navigation base tag unit tests */ (function($){ var baseDir = $.mobile.path.parseUrl($("base").attr("href")).directory, contentDir = $.mobile.path.makePathAbsolute("../content/", baseDir); module('jquery.mobile.navigation.js - base tag', { setup: function(){ if ( location.hash ) { stop(); ...
JavaScript
/* * mobile navigation unit tests */ (function($){ // TODO move siteDirectory over to the nav path helper var changePageFn = $.mobile.changePage, originalTitle = document.title, originalLinkBinding = $.mobile.linkBindingEnabled, siteDirectory = location.pathname.replace( /[^/]+$/, "" ), home = $.mobile.path...
JavaScript
/* * mobile navigation unit tests */ (function($){ var perspective = "viewport-flip", transitioning = "ui-mobile-viewport-transitioning", animationCompleteFn = $.fn.animationComplete, //TODO centralize class names? transitionTypes = "in out fade slide flip reverse pop", isTransitioning = function(pa...
JavaScript
/* * mobile widget unit tests */ (function($){ module('jquery.mobile.widget.js'); test( "getting data from creation options", function(){ var expected = "bizzle"; $.mobile.widget.prototype.options = { "fooBar" : true }; $.mobile.widget.prototype.element = $("<div data-foo-bar=" + expected + ">"); same($.m...
JavaScript
/* * mobile widget unit tests */ (function($){ var widgetInitialized = false; module( 'jquery.mobile.widget.js' ); $( "#foo" ).live( 'pageinit', function(){ // ordering sensitive here, the value has to be set after the call // so that if the widget factory says that its not yet initialized, // which is an ...
JavaScript
/* * mobile checkboxradio unit tests */ (function($){ module( 'jquery.mobile.forms.checkboxradio.js' ); test( "widget can be disabled and enabled", function(){ var input = $( "#checkbox-1" ), button = input.parent().find( ".ui-btn" ); input.checkboxradio( "disable" ); input.checkboxradio( "enable" ); o...
JavaScript
/* * mobile slider unit tests */ (function($){ $.mobile.page.prototype.options.keepNative = "input.should-be-native"; // not testing the positive case here since's it's obviously tested elsewhere test( "slider elements in the keepNative set shouldn't be enhanced", function() { same( $("input.should-be-native")....
JavaScript
/* * mobile slider unit tests */ (function($){ var onChangeCnt = 0; window.onChangeCounter = function() { onChangeCnt++; } module('jquery.mobile.slider.js'); var keypressTest = function(opts){ var slider = $(opts.selector), val = window.parseFloat(slider.val()), handle = slider.siblings('.ui-slid...
JavaScript
/* * degradeInputs unit tests */ (function($){ module('jquery.mobile.slider.js'); test('keepNative elements should not be degraded', function() { same($('input#not-to-be-degraded').attr("type"), "range"); }); test('should degrade input type to a different type, as specified in page options', ...
JavaScript
/* * mobile select unit tests */ (function($){ var resetHash; resetHash = function(timeout){ $.testHelper.openPage( location.hash.indexOf("#default") >= 0 ? "#" : "#default" ); }; // https://github.com/jquery/jquery-mobile/issues/2181 asyncTest( "dialog sized select should alter the value of its parent sele...
JavaScript
/* * mobile select unit tests */ (function($){ module("jquery.mobile.forms.select native"); test( "native menu selections alter the button text", function(){ var select = $( "#native-select-choice-few" ), setAndCheck; setAndCheck = function(key){ var text; select.val( key ).selectmenu( 'refresh' )...
JavaScript
/* * mobile select unit tests */ (function($){ var libName = "jquery.mobile.forms.select.js", originalDefaultDialogTrans = $.mobile.defaultDialogTransition, originalDefTransitionHandler = $.mobile.defaultTransitionHandler, originalGetEncodedText = $.fn.getEncodedText, resetHash, closeDialog; resetHash = f...
JavaScript
/* * mobile select unit tests */ (function($){ var libName = "jquery.mobile.forms.select.js"; $(document).bind('mobileinit', function(){ $.mobile.selectmenu.prototype.options.nativeMenu = false; }); module(libName,{ setup: function(){ $.testHelper.openPage( location.hash.indexOf("#default") >= 0 ? "#" :...
JavaScript
/* * mobile checkboxradio unit tests */ (function($){ module( 'vertical controlgroup, no refresh' , { setup: function() { this.vcontrolgroup = $( "#vertical-controlgroup" ); } }); test( "vertical controlgroup classes", function() { var buttons = this.vcontrolgroup.find( ".ui-btn" ), middlebuttons = bu...
JavaScript
(function(Perf) { var $listPage = $( "#list-page" ), firstCounter = 0; Perf.setCurrentRev(); Perf.pageLoadStart = Date.now(); $listPage.live( "pagebeforecreate", function() { if( firstCounter == 0 ) { Perf.pageCreateStart = Date.now(); firstCounter++; } }); $listPage.live( "pageinit", function( event...
JavaScript
window.Perf = (function($, Perf) { $.extend(Perf, { reportUrl: 'stats/', revUrl: 'stats/rev.php', // should be defined before report or poll are run currentRev: undefined, report: function( data, after ) { $.extend(data, { pathname: location.pathname, agent: this.agent(), agentFull: window.n...
JavaScript
(function($) { // TODO this is entire thing sucks $(function() { var searchMap = (function() { var searchSplit, searchMap = {}; if ( !location.search ){ return searchMap; } searchSplit = location.search.replace(/^\?/, "").split( /&|;/ ); for( var i = 0; i < searchSplit.length; i++ ) { var ...
JavaScript
/* * mobile support unit tests */ (function( $ ) { $.testHelper = { excludeFileProtocol: function(callback){ var message = "Tests require script reload and cannot be run via file: protocol"; if (location.protocol == "file:") { test(message, function(){ ok(false, message); }); } else { c...
JavaScript
//quick & dirty theme switcher, written to potentially work as a bookmarklet (function($){ $.themeswitcher = function(){ if( $('[data-'+ $.mobile.ns +'-url=themeswitcher]').length ){ return; } var themesDir = 'http://jquerymobile.com/test/css/themes/', themes = ['default','valencia'], currentPage = $.mobile....
JavaScript
//thx @elroyjetson for the code example // When map page opens get location and display map $('.page-map').live("pagecreate", function() { //boston :) var lat = 42.35843, lng = -71.059773; //try to get GPS coords if( navigator.geolocation ) { //redirect function for successful location function gpsS...
JavaScript
/* * jQuery Mobile Framework : scrollview plugin * Copyright (c) 2010 Adobe Systems Incorporated - Kin Blas (jblas@adobe.com) * Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses. * Note: Code is in draft form and is subject to change */ (function($,window,document,undefined){ jQuery.wid...
JavaScript
function ResizePageContentHeight(page) { var $page = $(page), $content = $page.children( ".ui-content" ), hh = $page.children( ".ui-header" ).outerHeight() || 0, fh = $page.children( ".ui-footer" ).outerHeight() || 0, pt = parseFloat($content.css( "padding-top" )), pb = parseFloat($content.css( "padding-bott...
JavaScript
/* * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ * * Uses the built in easing capabilities added In jQuery 1.1 * to offer multiple easing options * * TERMS OF USE - jQuery Easing * * Open source under the BSD License. * * Copyright © 2008 George McGinley Smith * All rights reserved. * ...
JavaScript
/* * Copy of http://github.com/nje/jquery-tmpl/raw/master/jquery.tmpl.js at f827fb68417bc14ab9f6ae889421d5fea4cb2859 * jQuery Templating Plugin * Copyright 2010, John Resig * Dual licensed under the MIT or GPL Version 2 licenses. */ (function( jQuery, undefined ){ var oldManip = jQuery.fn.domManip, tmplItmAtt = "...
JavaScript
$(function() { var symbols = { "USD": "$", "EUR": "&euro;", "GBP": "&pound;", "Miles": "m", "Kilometer": "km", "inch": "\"", "centimeter": "cm" }; function list() { var ul = $( "#conversions" ).empty(), ulEdit = $( "#edit-conversions" ).empty(); $.each( all, function( index, conversion ) { ...
JavaScript
(function() { var defaults = [ { type: "currency", from: "USD", to: "EUR" }, { type: "currency", from: "GBP", to: "EUR" } // TODO add back in as defaults once its possible to add other conversions, not just currencies /*, { type: "distance", from: "Miles", to: "Kilometer", rate: 1.609344 },...
JavaScript
/* * StringBuffer class */ function StringBuffer() { this.buffer = []; } StringBuffer.prototype.append = function append (string) { this.buffer.push(string); return this; }; StringBuffer.prototype.toString = function toString () { return this.buffer.join(""); }; /* * Strip html tags */ function ...
JavaScript
/*! * jQuery Mobile v1.0b2 * http://jquerymobile.com/ * * Copyright 2010, jQuery Project * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license */ /*! * jQuery UI Widget @VERSION * * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Ver...
JavaScript
//quick view source in new window links $.fn.addSourceLink = function(style){ return $(this).each(function(){ var link = $('<a href="#" data-'+ $.mobile.ns +'inline="true">View Source</a>'), src = src = $('<div></div>').append( $(this).clone() ).html(), page = $( "<div data-"+ $.mobile.ns +"role='dialog' data...
JavaScript
//set up the theme switcher on the homepage $('div').live('pagecreate',function(event){ if( !$(this).is('.ui-dialog')){ var appendEl = $(this).find('.ui-footer:last'); if( !appendEl.length ){ appendEl = $(this).find('.ui-content'); } if( appendEl.is("[data-position]") ){ return; } $('<a hre...
JavaScript
/* * mobile button unit tests */ (function($){ $.mobile.page.prototype.options.keepNative = "button.should-be-native"; test( "button elements in the keepNative set shouldn't be enhanced", function() { same( $("button.should-be-native").siblings("div.ui-slider").length, 0 ); }); test( "button elements should b...
JavaScript
/* * mobile page unit tests */ (function($){ var libName = 'jquery.mobile.page.js'; module(libName); test( "nested header anchors aren't altered", function(){ ok(!$('.ui-header > div > a').hasClass('ui-btn')); }); test( "nested footer anchors aren't altered", function(){ ok(!$('.ui-footer > div > a').hasC...
JavaScript
/* * mobile textinput unit tests */ (function($){ module( "jquery.mobile.forms.textinput.js" ); test( "inputs without type specified are enhanced", function(){ ok( $( "#typeless-input" ).hasClass( "ui-input-text" ) ); }); $.mobile.page.prototype.options.keepNative = "textarea.should-be-native"; // not testi...
JavaScript
(function($) { asyncTest( "nested pages hash key is always in the hash on default page with no id (replaceState) ", function(){ $.testHelper.pageSequence([ function(){ // Click on the link of the third li element $('.ui-page-active li:eq(2) a:eq(0)').click(); }, function(){ ok( location.hash.se...
JavaScript
/* * mobile listview unit tests */ // TODO split out into seperate test files (function($){ var home = $.mobile.path.parseUrl( location.href ).pathname; $.mobile.defaultTransition = "none"; module( "Basic Linked list", { setup: function(){ $.testHelper.openPage( "#basic-linked-test" ); } }); asyncTes...
JavaScript