Removed themeswitcher in docs.

This commit is contained in:
Mat Marquis 2012-01-11 14:53:09 -05:00 committed by scottjehl
parent f7aa71d423
commit 930d69ab37
2 changed files with 20 additions and 64 deletions

View file

@ -1,33 +1,6 @@
//set up the theme switcher on the homepage
define( [ "jquery.mobile" ], function() {
$('div').live('pagecreate',function(event){
if( !$(this).is('.ui-dialog-page')){
var appendEl = $(this).find('.ui-footer:last');
if( !appendEl.length ){
appendEl = $(this).find('.ui-content');
}
if( appendEl.is("[data-position]") ){
return;
}
$('<a href="#themeswitcher" data-'+ $.mobile.ns +'rel="dialog" data-'+ $.mobile.ns +'transition="pop">Switch theme</a>')
.buttonMarkup({
'icon':'gear',
'inline': true,
'shadow': false,
'theme': 'd'
})
.appendTo( appendEl )
.wrap('<div class="jqm-themeswitcher">')
.bind( "vclick", function(){
$.themeswitcher();
});
}
});
//collapse page navs after use
$(function(){
@ -36,6 +9,26 @@ $(function(){
});
});
function setDefaultTransition(){
var winwidth = $( window ).width(),
trans ="slide";
if( winwidth >= 1000 ){
trans = "none";
}
else if( winwidth >= 650 ){
trans = "fade";
}
$.mobile.defaultPageTransition = trans;
}
$(function(){
setDefaultTransition();
$( window ).bind( "throttledresize", setDefaultTransition );
});
// Turn off AJAX for local file browsing
if ( location.protocol.substr(0,4) === 'file' ||

View file

@ -1,37 +0,0 @@
//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.activePage,
menuPage = $( '<div data-'+ $.mobile.ns +'url="themeswitcher" data-'+ $.mobile.ns +'role=\'dialog\' data-'+ $.mobile.ns +'theme=\'a\'>' +
'<div data-'+ $.mobile.ns +'role=\'header\' data-'+ $.mobile.ns +'theme=\'b\'>' +
'<div class=\'ui-title\'>Switch Theme:</div>'+
'</div>'+
'<div data-'+ $.mobile.ns +'role=\'content\' data-'+ $.mobile.ns +'theme=\'c\'><ul data-'+ $.mobile.ns +'role=\'listview\' data-'+ $.mobile.ns +'inset=\'true\'></ul></div>'+
'</div>' )
.appendTo( $.mobile.pageContainer ),
menu = menuPage.find('ul');
//menu items
$.each(themes, function( i ){
$('<li><a href="#" data-'+ $.mobile.ns +'rel="back">' + themes[ i ].charAt(0).toUpperCase() + themes[ i ].substr(1) + '</a></li>')
.bind("vclick", function(){
addTheme( themes[i] );
menuPage.dialog( "close" );
return false;
})
.appendTo(menu);
});
//remover, adder
function addTheme(theme){
$('head').append( '<link rel=\'stylesheet\' href=\''+ themesDir + theme +'/\' />' );
}
//create page, listview
menuPage.page();
};
})(jQuery);