jinda 0.6.5 → 0.6.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/generators/jinda/config_generator.rb +7 -0
- data/lib/generators/jinda/install_generator.rb +45 -42
- data/lib/generators/jinda/templates/app/assets/javascripts/application.js +1 -10
- data/lib/generators/jinda/templates/app/assets/stylesheets/application.css.scss +1 -20
- data/lib/jinda.rb +2 -1
- data/lib/jinda/date_helpers.rb +109 -0
- data/lib/jinda/{gemhelpers.rb → gem_helpers.rb} +0 -1
- data/lib/jinda/gen_class.rb +13 -0
- data/lib/jinda/gen_controller.rb +10 -0
- data/lib/jinda/gen_freemind.rb +33 -0
- data/lib/jinda/gen_helpers.rb +141 -0
- data/lib/jinda/gen_models.rb +137 -0
- data/lib/jinda/gen_runseq.rb +71 -0
- data/lib/jinda/gen_services.rb +90 -0
- data/lib/jinda/gen_xmain.rb +38 -0
- data/lib/jinda/get_app.rb +34 -0
- data/lib/jinda/helpers.rb +17 -998
- data/lib/jinda/init_vars.rb +36 -0
- data/lib/jinda/rake_views.rb +59 -0
- data/lib/jinda/refresh.rb +67 -0
- data/lib/jinda/themes.rb +163 -0
- data/lib/jinda/version.rb +1 -1
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/config/manifest.js +3 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/channels/application_cable/channel.rb +4 -0
- data/test/dummy/app/channels/application_cable/connection.rb +4 -0
- data/test/dummy/app/controllers/application_controller.rb +2 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/javascript/packs/application.js +15 -0
- data/test/dummy/app/jobs/application_job.rb +7 -0
- data/test/dummy/app/mailers/application_mailer.rb +4 -0
- data/test/dummy/app/models/application_record.rb +3 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +33 -0
- data/test/dummy/config.ru +5 -0
- data/test/dummy/config/application.rb +19 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/cable.yml +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +62 -0
- data/test/dummy/config/environments/production.rb +112 -0
- data/test/dummy/config/environments/test.rb +49 -0
- data/test/dummy/config/initializers/application_controller_renderer.rb +8 -0
- data/test/dummy/config/initializers/assets.rb +12 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/content_security_policy.rb +28 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +33 -0
- data/test/dummy/config/puma.rb +38 -0
- data/test/dummy/config/routes.rb +3 -0
- data/test/dummy/config/spring.rb +6 -0
- data/test/dummy/config/storage.yml +34 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/log/development.log +8 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/test/dummy/public/apple-touch-icon.png +0 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/tmp/development_secret.txt +1 -0
- data/test/integration/navigation_test.rb +7 -0
- data/test/jinda_test.rb +7 -0
- data/test/test_helper.rb +19 -0
- metadata +84 -141
- data/lib/generators/jinda/templates/app/assets/images/4dcity-old.ico +0 -0
- data/lib/generators/jinda/templates/app/assets/images/4dcity.ico +0 -0
- data/lib/generators/jinda/templates/app/assets/images/account.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/add.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/ajax-loader-circle.gif +0 -0
- data/lib/generators/jinda/templates/app/assets/images/ajax-loader.gif +0 -0
- data/lib/generators/jinda/templates/app/assets/images/anchor.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/application_double.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/application_form_edit.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/arrow_left.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/arrow_right.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/arrow_turn_left.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/arrow_turn_right.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/calendar.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/cancel.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/chart_bar.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/clock.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/cog.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/control_fastforward.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/control_play.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/cross.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/delete.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/external-link.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/facebook-continue-button.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/facebooksmall.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/favicon.ico +0 -0
- data/lib/generators/jinda/templates/app/assets/images/freemind(mm).png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/google-continue-button.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/help.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/highway-menu.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/highway.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/house.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/icons-18-black.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/icons-18-white.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/icons-36-black.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/icons-36-white.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/logo.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/logo_jinda.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/logout.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/new.gif +0 -0
- data/lib/generators/jinda/templates/app/assets/images/new.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/page.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/page_attach.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/page_green.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/page_output.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/page_pdf.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/pencil.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/printer.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/refresh.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/report.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/rssmall.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/tick.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/twittersmall.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/user.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/user_admin_gear.png +0 -0
- data/lib/generators/jinda/templates/app/assets/images/view_code.png +0 -0
- data/lib/generators/jinda/templates/app/assets/javascripts/application.js-jqm +0 -27
- data/lib/generators/jinda/templates/app/assets/javascripts/cable.js +0 -13
- data/lib/generators/jinda/templates/app/assets/javascripts/disable_enter_key.js +0 -10
- data/lib/generators/jinda/templates/app/assets/javascripts/iscroll-wrapper.js +0 -32
- data/lib/generators/jinda/templates/app/assets/javascripts/iscroll.js +0 -1084
- data/lib/generators/jinda/templates/app/assets/javascripts/jinda.js +0 -14
- data/lib/generators/jinda/templates/app/assets/javascripts/jquery.mobile-1.2.1.js +0 -9272
- data/lib/generators/jinda/templates/app/assets/javascripts/jquery.mobile.datebox.js +0 -1778
- data/lib/generators/jinda/templates/app/assets/javascripts/jquery.mobile.splitview.js +0 -695
- data/lib/generators/jinda/templates/app/assets/stylesheets/app.scss +0 -90
- data/lib/generators/jinda/templates/app/assets/stylesheets/articles.scss +0 -94
- data/lib/generators/jinda/templates/app/assets/stylesheets/fonts/sarabun.eot +0 -0
- data/lib/generators/jinda/templates/app/assets/stylesheets/fonts/sarabun.ttf +0 -0
- data/lib/generators/jinda/templates/app/assets/stylesheets/fonts/sarabun.woff +0 -0
- data/lib/generators/jinda/templates/app/assets/stylesheets/fonts/sarabun_bold.ttf +0 -0
- data/lib/generators/jinda/templates/app/assets/stylesheets/fonts/sarabun_bolditalic.ttf +0 -0
- data/lib/generators/jinda/templates/app/assets/stylesheets/fonts/sarabun_italic.ttf +0 -0
- data/lib/generators/jinda/templates/app/assets/stylesheets/fonts/thsarabunnew-webfont.eot +0 -0
- data/lib/generators/jinda/templates/app/assets/stylesheets/fonts/thsarabunnew-webfont.ttf +0 -0
- data/lib/generators/jinda/templates/app/assets/stylesheets/fonts/thsarabunnew-webfont.woff +0 -0
- data/lib/generators/jinda/templates/app/assets/stylesheets/fonts/thsarabunnew.css +0 -47
- data/lib/generators/jinda/templates/app/assets/stylesheets/fonts/thsarabunnew_bold-webfont.eot +0 -0
- data/lib/generators/jinda/templates/app/assets/stylesheets/fonts/thsarabunnew_bold-webfont.ttf +0 -0
- data/lib/generators/jinda/templates/app/assets/stylesheets/fonts/thsarabunnew_bold-webfont.woff +0 -0
- data/lib/generators/jinda/templates/app/assets/stylesheets/fonts/thsarabunnew_bolditalic-webfont.eot +0 -0
- data/lib/generators/jinda/templates/app/assets/stylesheets/fonts/thsarabunnew_bolditalic-webfont.ttf +0 -0
- data/lib/generators/jinda/templates/app/assets/stylesheets/fonts/thsarabunnew_bolditalic-webfont.woff +0 -0
- data/lib/generators/jinda/templates/app/assets/stylesheets/fonts/thsarabunnew_italic-webfont.eot +0 -0
- data/lib/generators/jinda/templates/app/assets/stylesheets/fonts/thsarabunnew_italic-webfont.ttf +0 -0
- data/lib/generators/jinda/templates/app/assets/stylesheets/fonts/thsarabunnew_italic-webfont.woff +0 -0
- data/lib/generators/jinda/templates/app/assets/stylesheets/images/ajax-loader.gif +0 -0
- data/lib/generators/jinda/templates/app/assets/stylesheets/images/button_black.png +0 -0
- data/lib/generators/jinda/templates/app/assets/stylesheets/images/button_blue.png +0 -0
- data/lib/generators/jinda/templates/app/assets/stylesheets/images/button_red.png +0 -0
- data/lib/generators/jinda/templates/app/assets/stylesheets/images/icons-18-black.png +0 -0
- data/lib/generators/jinda/templates/app/assets/stylesheets/images/icons-18-white.png +0 -0
- data/lib/generators/jinda/templates/app/assets/stylesheets/images/icons-36-black.png +0 -0
- data/lib/generators/jinda/templates/app/assets/stylesheets/images/icons-36-white.png +0 -0
- data/lib/generators/jinda/templates/app/assets/stylesheets/images/indicator.gif +0 -0
- data/lib/generators/jinda/templates/app/assets/stylesheets/jinda.css +0 -52
- data/lib/generators/jinda/templates/app/assets/stylesheets/jquery.mobile-1.2.1.css +0 -2339
- data/lib/generators/jinda/templates/app/assets/stylesheets/jquery.mobile.datebox.css +0 -65
- data/lib/generators/jinda/templates/app/assets/stylesheets/jquery.mobile.grids.collapsible.css +0 -122
- data/lib/generators/jinda/templates/app/assets/stylesheets/jquery.mobile.splitview.css +0 -128
- data/lib/generators/jinda/templates/app/assets/stylesheets/kul-4.2.css +0 -1516
- data/lib/generators/jinda/templates/app/assets/stylesheets/kul-4.2.min.css +0 -11
- data/lib/generators/jinda/templates/app/assets/stylesheets/modules.scss +0 -84
- data/lib/generators/jinda/templates/app/assets/stylesheets/sarabun.css +0 -37
- data/lib/generators/jinda/templates/app/assets/stylesheets/social.scss +0 -133
- data/lib/generators/jinda/templates/app/controllers/concerns/jinda_general_concern.rb +0 -179
- data/lib/generators/jinda/templates/app/controllers/concerns/jinda_run_concern.rb +0 -365
- data/lib/generators/jinda/templates/app/controllers/jinda_org/devs_controller.rb +0 -2
- data/lib/generators/jinda/templates/app/controllers/jinda_org/jinda_controller.rb +0 -66
- data/lib/generators/jinda/templates/app/views/jinda/_activity.md +0 -10
- data/lib/generators/jinda/templates/app/views/jinda/_menu.haml +0 -27
- data/lib/generators/jinda/templates/app/views/jinda/_menu_mm.haml +0 -44
- data/lib/generators/jinda/templates/app/views/jinda/_model.md +0 -5
- data/lib/generators/jinda/templates/app/views/jinda/_modul.md +0 -9
- data/lib/generators/jinda/templates/app/views/jinda/_pending_home.haml +0 -5
- data/lib/generators/jinda/templates/app/views/jinda/_pending_page.haml +0 -24
- data/lib/generators/jinda/templates/app/views/jinda/_service.md +0 -24
- data/lib/generators/jinda/templates/app/views/jinda/_static.haml +0 -13
- data/lib/generators/jinda/templates/app/views/jinda/doc-thai.md +0 -37
- data/lib/generators/jinda/templates/app/views/jinda/doc.md +0 -36
- data/lib/generators/jinda/templates/app/views/jinda/error_logs.haml +0 -22
- data/lib/generators/jinda/templates/app/views/jinda/feed.rss.builder +0 -27
- data/lib/generators/jinda/templates/app/views/jinda/help.haml +0 -20
- data/lib/generators/jinda/templates/app/views/jinda/index.html.haml +0 -53
- data/lib/generators/jinda/templates/app/views/jinda/logs.haml +0 -22
- data/lib/generators/jinda/templates/app/views/jinda/notice_logs.haml +0 -18
- data/lib/generators/jinda/templates/app/views/jinda/pending.haml +0 -1
- data/lib/generators/jinda/templates/app/views/jinda/run_form.haml +0 -42
- data/lib/generators/jinda/templates/app/views/jinda/run_output.haml +0 -38
- data/lib/generators/jinda/templates/app/views/jinda/search.haml +0 -20
- data/lib/generators/jinda/templates/app/views/jinda/status.haml +0 -61
@@ -1,695 +0,0 @@
|
|
1
|
-
// TODO: fix all the position: absolute issues caused by getScreenHeight and newResetActivePageHeight. these two need fixin.
|
2
|
-
// TODO: need to check for tablets performance - using overflow: auto instead of position:fixed. these will probably need fixin as well.
|
3
|
-
|
4
|
-
// TODO: reinstate replaceBackBtn - to include the case where people actually really want the back btn
|
5
|
-
(function($,window,undefined){
|
6
|
-
$( window.document ).bind('mobileinit', function(){
|
7
|
-
$.mobile = $.extend( {}, {
|
8
|
-
menuWidth: '25%',
|
9
|
-
menuMinWidth: '250px',
|
10
|
-
menuBtnSide: 'left',
|
11
|
-
}, $.mobile );
|
12
|
-
|
13
|
-
//some class for css to detect touchscreens
|
14
|
-
if($.support.touch){
|
15
|
-
$('html').addClass('touch');
|
16
|
-
}
|
17
|
-
var $query = $.mobile.media('screen and (min-width: 480px)') && ($.mobile.media('(-webkit-max-device-pixel-ratio: 3.0)') || $.mobile.media('(max--moz-device-pixel-ratio: 3.0)'));
|
18
|
-
$.support.splitview = ($query || ($.mobile.browser.ie && $(this).width() >= 480)) && $.mobile.ajaxEnabled;
|
19
|
-
if ($.support.splitview) {
|
20
|
-
$('html').addClass('splitview');
|
21
|
-
//on window.ready() execution:
|
22
|
-
$(function() {
|
23
|
-
// TODO: cleanup if all is ok
|
24
|
-
// $.mobile.linkBindingEnabled = false;
|
25
|
-
// $(document).unbind('.toolbar');
|
26
|
-
// $('.ui-page').off('.toolbar');
|
27
|
-
$('div:jqmData(role="panel")').addClass('ui-mobile-viewport ui-panel');
|
28
|
-
var firstPageMain=$('div:jqmData(id="main") > div:jqmData(role="page"):first');
|
29
|
-
if( !$.mobile.hashListeningEnabled || !$.mobile.path.stripHash( location.hash ) ){
|
30
|
-
var $container=$('div:jqmData(id="main")');
|
31
|
-
$.mobile.firstPage = firstPageMain;
|
32
|
-
$.mobile.pageContainer = $container;
|
33
|
-
$(window).trigger('pagecontainercreate');
|
34
|
-
$.mobile.changePage(firstPageMain, {transition:'none', changeHash:false, pageContainer:$container});
|
35
|
-
$.mobile.activePage=undefined;
|
36
|
-
} //no need to trigger a hashchange here cause the other page is handled by core.
|
37
|
-
|
38
|
-
// setup the layout for splitview and jquerymobile will handle first page init
|
39
|
-
$(window).trigger('orientationchange');
|
40
|
-
setTimeout(function(){
|
41
|
-
$.mobile.firstPage = firstPageMain;
|
42
|
-
}, 100)
|
43
|
-
}); //end window.ready()
|
44
|
-
|
45
|
-
//----------------------------------------------------------------------------------
|
46
|
-
//Main event bindings: click, form submits, hashchange and orientationchange/resize(popover)
|
47
|
-
//----------------------------------------------------------------------------------
|
48
|
-
//existing base tag?
|
49
|
-
var $window = $( window ),
|
50
|
-
$html = $( 'html' ),
|
51
|
-
$head = $( 'head' ),
|
52
|
-
$base = $head.children( "base" ),
|
53
|
-
$activeClickedLink = null,
|
54
|
-
//tuck away the original document URL minus any fragment.
|
55
|
-
documentUrl = $.mobile.path.parseUrl( location.href ),
|
56
|
-
|
57
|
-
//if the document has an embedded base tag, documentBase is set to its
|
58
|
-
//initial value. If a base tag does not exist, then we default to the documentUrl.
|
59
|
-
documentBase = $base.length ? $.mobile.path.parseUrl( $.mobile.path.makeUrlAbsolute( $base.attr( "href" ), documentUrl.href ) ) : documentUrl,
|
60
|
-
getScreenHeight = $.mobile.getScreenHeight;
|
61
|
-
|
62
|
-
//remove active classes after page transition or error
|
63
|
-
function removeActiveLinkClass( forceRemoval ) {
|
64
|
-
if ( !!$activeClickedLink && ( !$activeClickedLink.closest( "." + $.mobile.activePageClass ).length || forceRemoval ) ) {
|
65
|
-
$activeClickedLink.removeClass( $.mobile.activeBtnClass );
|
66
|
-
}
|
67
|
-
$activeClickedLink = null;
|
68
|
-
}
|
69
|
-
|
70
|
-
function findClosestLink(ele)
|
71
|
-
{
|
72
|
-
while (ele){
|
73
|
-
if ( ( typeof ele.nodeName === "string") && ele.nodeName.toLowerCase() == "a"){
|
74
|
-
break;
|
75
|
-
}
|
76
|
-
ele = ele.parentNode;
|
77
|
-
}
|
78
|
-
return ele;
|
79
|
-
}
|
80
|
-
|
81
|
-
// The base URL for any given element depends on the page it resides in.
|
82
|
-
function getClosestBaseUrl( ele )
|
83
|
-
{
|
84
|
-
// Find the closest page and extract out its url.
|
85
|
-
var url = $( ele ).closest( ".ui-page" ).jqmData( "url" ),
|
86
|
-
base = documentBase.hrefNoHash;
|
87
|
-
|
88
|
-
if ( !url || !$.mobile.path.isPath( url ) ) {
|
89
|
-
url = base;
|
90
|
-
}
|
91
|
-
|
92
|
-
return $.mobile.path.makeUrlAbsolute( url, base);
|
93
|
-
}
|
94
|
-
|
95
|
-
function ResetActivePageHeight(container){
|
96
|
-
var aPage;
|
97
|
-
// aPagePadT = parseFloat( aPage.css( "padding-top" ) ),
|
98
|
-
// aPagePadB = parseFloat( aPage.css( "padding-bottom" ) ),
|
99
|
-
// aPageBorderT = parseFloat( aPage.css( "border-top-width" ) ),
|
100
|
-
// aPageBorderB = parseFloat( aPage.css( "border-bottom-width" ) );
|
101
|
-
|
102
|
-
if(container !== null && typeof container !== 'undefined') {
|
103
|
-
aPage = container.find("." + $.mobile.activePageClass);
|
104
|
-
} else {
|
105
|
-
aPage = $( "." + $.mobile.activePageClass );
|
106
|
-
}
|
107
|
-
|
108
|
-
aPage.each(function(i, page){
|
109
|
-
page = $(page)
|
110
|
-
var pagePadT = parseFloat( page.css( "padding-top" )),
|
111
|
-
pagePadB = parseFloat( page.css( "padding-bottom" )),
|
112
|
-
pageBorderT = parseFloat( page.css( "border-top-width" )),
|
113
|
-
pageBorderB = parseFloat( page.css( "border-bottom-width" ));
|
114
|
-
page.css( "min-height", getScreenHeight() - pagePadT - pagePadB - pageBorderT - pageBorderB );
|
115
|
-
})
|
116
|
-
}
|
117
|
-
|
118
|
-
//override _registerInternalEvents to bind to new methods below
|
119
|
-
$.mobile._registerInternalEvents = function(){
|
120
|
-
//DONE: bind form submit with this plugin
|
121
|
-
$( document ).delegate("form", "submit", function(event){
|
122
|
-
var $this = $( this );
|
123
|
-
|
124
|
-
if( !$.mobile.ajaxEnabled ||
|
125
|
-
$this.is( ":jqmData(ajax='false')" ) ||
|
126
|
-
!$this.jqmHijackable().length ){
|
127
|
-
return;
|
128
|
-
}
|
129
|
-
|
130
|
-
var type = $this.attr("method"),
|
131
|
-
target = $this.attr("target"),
|
132
|
-
url = $this.attr( "action" );
|
133
|
-
|
134
|
-
// If the form has a data-panel attribute, load the page in that panel instead.
|
135
|
-
var $targetPanel = null;
|
136
|
-
var $targetPanelId = $this.jqmData("panel");
|
137
|
-
if ($targetPanelId === undefined) {
|
138
|
-
$targetPanel = $this.parents('div:jqmData(role="panel")');
|
139
|
-
} else {
|
140
|
-
$targetPanel = $('div:jqmData(id="' + $targetPanelId + '")');
|
141
|
-
}
|
142
|
-
var $targetPanelActivePage=$targetPanel.children('div.'+$.mobile.activePageClass);
|
143
|
-
|
144
|
-
// If no action is specified, browsers default to using the
|
145
|
-
// URL of the document containing the form. Since we dynamically
|
146
|
-
// pull in pages from external documents, the form should submit
|
147
|
-
// to the URL for the source document of the page containing
|
148
|
-
// the form.
|
149
|
-
if ( !url ) {
|
150
|
-
// Get the @data-url for the page containing the form.
|
151
|
-
url = getClosestBaseUrl( $this );
|
152
|
-
if ( url === documentBase.hrefNoHash ) {
|
153
|
-
// The url we got back matches the document base,
|
154
|
-
// which means the page must be an internal/embedded page,
|
155
|
-
// so default to using the actual document url as a browser
|
156
|
-
// would.
|
157
|
-
url = documentUrl.hrefNoSearch;
|
158
|
-
}
|
159
|
-
}
|
160
|
-
|
161
|
-
url = $.mobile.path.makeUrlAbsolute( url, getClosestBaseUrl($this) );
|
162
|
-
|
163
|
-
//external submits use regular HTTP
|
164
|
-
if( ( $.mobile.path.isExternal( url ) && !path.isPermittedCrossDomainRequest( documentUrl, url ) ) || target ) {
|
165
|
-
return;
|
166
|
-
}
|
167
|
-
|
168
|
-
//temporarily put this here- eventually shud just set it immediately instead of an interim var.
|
169
|
-
$.mobile.activePage=$targetPanelActivePage;
|
170
|
-
// $.mobile.pageContainer=$targetPanel;
|
171
|
-
$.mobile.changePage(
|
172
|
-
url,
|
173
|
-
{
|
174
|
-
type: type && type.length && type.toLowerCase() || "get",
|
175
|
-
data: $this.serialize(),
|
176
|
-
transition: $this.jqmData("transition"),
|
177
|
-
reverse: $this.jqmData("direction") === "reverse",
|
178
|
-
reloadPage: true,
|
179
|
-
pageContainer:$targetPanel
|
180
|
-
}
|
181
|
-
);
|
182
|
-
event.preventDefault();
|
183
|
-
});
|
184
|
-
|
185
|
-
//add active state on vclick
|
186
|
-
|
187
|
-
$( document ).bind( "vclick", function( event ) {
|
188
|
-
if ( event.which > 1 || !$.mobile.linkBindingEnabled ) {
|
189
|
-
return;
|
190
|
-
}
|
191
|
-
|
192
|
-
var link = findClosestLink( event.target );
|
193
|
-
|
194
|
-
if ( !$( link ).jqmHijackable().length ) {
|
195
|
-
return;
|
196
|
-
}
|
197
|
-
|
198
|
-
if ( link ) {
|
199
|
-
if ( $.mobile.path.parseUrl( link.getAttribute( "href" ) || "#" ).hash !== "#" ) {
|
200
|
-
removeActiveLinkClass( true );
|
201
|
-
$activeClickedLink = $( link ).closest( ".ui-btn" ).not( ".ui-disabled" )
|
202
|
-
$activeClickedLink.addClass( $.mobile.activeBtnClass );
|
203
|
-
// $( "." + $.mobile.activePageClass + " .ui-btn" ).not( link ).blur();
|
204
|
-
}
|
205
|
-
}
|
206
|
-
});
|
207
|
-
|
208
|
-
//DONE: link click event binding for changePage
|
209
|
-
//click routing - direct to HTTP or Ajax, accordingly
|
210
|
-
$(document).bind( "click", function(event) {
|
211
|
-
if ( !$.mobile.linkBindingEnabled ) {
|
212
|
-
return;
|
213
|
-
}
|
214
|
-
|
215
|
-
var link = findClosestLink(event.target),
|
216
|
-
$link = $( link ),
|
217
|
-
httpCleanup;
|
218
|
-
|
219
|
-
if (!link || event.which > 1 || !$link.jqmHijackable().length ){
|
220
|
-
return;
|
221
|
-
}
|
222
|
-
|
223
|
-
httpCleanup = function() {
|
224
|
-
window.setTimeout(function() { removeActiveLinkClass( true ); })
|
225
|
-
}
|
226
|
-
|
227
|
-
//if there's a data-rel=back attr, go back in history
|
228
|
-
if( $link.is( ":jqmData(rel='back')" ) ) {
|
229
|
-
$.mobile.back();
|
230
|
-
return false;
|
231
|
-
}
|
232
|
-
|
233
|
-
var baseUrl = getClosestBaseUrl( $link ),
|
234
|
-
|
235
|
-
//get href, if defined, otherwise fall to null #
|
236
|
-
href = $.mobile.path.makeUrlAbsolute( $link.attr( "href" ) || "#", baseUrl );
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
//if ajax is disabled, exit early
|
241
|
-
if( !$.mobile.ajaxEnabled && !$.mobile.path.isEmbeddedPage( href ) ) {
|
242
|
-
httpCleanup();
|
243
|
-
//use default click handling
|
244
|
-
return;
|
245
|
-
}
|
246
|
-
|
247
|
-
// XXX_jblas: Ideally links to application pages should be specified as
|
248
|
-
// an url to the application document with a hash that is either
|
249
|
-
// the site relative path or id to the page. But some of the
|
250
|
-
// internal code that dynamically generates sub-pages for nested
|
251
|
-
// lists and select dialogs, just write a hash in the link they
|
252
|
-
// create. This means the actual URL path is based on whatever
|
253
|
-
// the current value of the base tag is at the time this code
|
254
|
-
// is called. For now we are just assuming that any url with a
|
255
|
-
// hash in it is an application page reference.
|
256
|
-
if ( href.search( "#" ) !== -1 ) {
|
257
|
-
href = href.replace( /[^#]*#/, "" );
|
258
|
-
if ( !href ) {
|
259
|
-
//link was an empty hash meant purely
|
260
|
-
//for interaction, so we ignore it.
|
261
|
-
event.preventDefault();
|
262
|
-
return;
|
263
|
-
} else if ( $.mobile.path.isPath( href ) ) {
|
264
|
-
//we have apath so make it the href we want to load.
|
265
|
-
href = $.mobile.path.makeUrlAbsolute( href, baseUrl );
|
266
|
-
} else {
|
267
|
-
//we have a simple id so use the documentUrl as its base.
|
268
|
-
href = $.mobile.path.makeUrlAbsolute( "#" + href, documentUrl.hrefNoHash );
|
269
|
-
}
|
270
|
-
}
|
271
|
-
|
272
|
-
// Should we handle this link, or let the browser deal with it?
|
273
|
-
var useDefaultUrlHandling = $link.is( "[rel='external']" ) || $link.is( ":jqmData(ajax='false')" ) || $link.is( "[target]" ),
|
274
|
-
// Some embedded browsers, like the web view in Phone Gap, allow cross-domain XHR
|
275
|
-
// requests if the document doing the request was loaded via the file:// protocol.
|
276
|
-
// This is usually to allow the application to "phone home" and fetch app specific
|
277
|
-
// data. We normally let the browser handle external/cross-domain urls, but if the
|
278
|
-
// allowCrossDomainPages option is true, we will allow cross-domain http/https
|
279
|
-
// requests to go through our page loading logic.
|
280
|
-
//isCrossDomainPageLoad = ( $.mobile.allowCrossDomainPages && documentUrl.protocol === "file:" && href.search( /^https?:/ ) != -1 ),
|
281
|
-
|
282
|
-
//check for protocol or rel and its not an embedded page
|
283
|
-
//TODO overlap in logic from isExternal, rel=external check should be
|
284
|
-
// moved into more comprehensive isExternalLink
|
285
|
-
isExternal = useDefaultUrlHandling || ( $.mobile.path.isExternal( href ) && !$.mobile.path.isPermittedCrossDomainRequest( documentUrl, href ) ),
|
286
|
-
|
287
|
-
isRefresh=$link.jqmData('refresh'),
|
288
|
-
$targetPanel=$link.jqmData('panel'),
|
289
|
-
$targetContainer=$('div:jqmData(id="'+$targetPanel+'")'),
|
290
|
-
$targetPanelActivePage=$targetContainer.children('div.'+$.mobile.activePageClass),
|
291
|
-
$currPanel=$link.parents('div:jqmData(role="panel")'),
|
292
|
-
//not sure we need this. if you want the container of the element that triggered this event, $currPanel
|
293
|
-
$currContainer=$.mobile.pageContainer,
|
294
|
-
$currPanelActivePage=$currPanel.children('div.'+$.mobile.activePageClass),
|
295
|
-
url=$.mobile.path.stripHash($link.attr("href")),
|
296
|
-
from = null;
|
297
|
-
|
298
|
-
//still need this hack apparently:
|
299
|
-
$('.ui-btn.'+$.mobile.activeBtnClass).removeClass($.mobile.activeBtnClass);
|
300
|
-
$activeClickedLink = $link.closest( ".ui-btn" ).addClass($.mobile.activeBtnClass);
|
301
|
-
|
302
|
-
if( isExternal ) {
|
303
|
-
httpCleanup();
|
304
|
-
//use default click handling
|
305
|
-
return;
|
306
|
-
}
|
307
|
-
|
308
|
-
//use ajax
|
309
|
-
var transitionVal = $link.jqmData( "transition" ),
|
310
|
-
reverseVal = $link.jqmData("direction") === "reverse" ||
|
311
|
-
// deprecated - remove by 1.0
|
312
|
-
$link.jqmData( "back" ),
|
313
|
-
//this may need to be more specific as we use data-rel more
|
314
|
-
role = $link.attr( "data-" + $.mobile.ns + "rel" ) || undefined,
|
315
|
-
hash = $currPanel.jqmData('hash');
|
316
|
-
|
317
|
-
//if link refers to an already active panel, stop default action and return
|
318
|
-
if ($targetPanelActivePage.attr('data-url') == url || $currPanelActivePage.attr('data-url') == url) {
|
319
|
-
if (isRefresh) { //then changePage below because it's a pageRefresh request
|
320
|
-
$.mobile.changePage(href, {fromPage:from, transition:'fade', reverse:reverseVal, changeHash:false, pageContainer:$targetContainer, reloadPage:isRefresh, role:role, link:$link});
|
321
|
-
}
|
322
|
-
else { //else preventDefault and return
|
323
|
-
event.preventDefault();
|
324
|
-
return;
|
325
|
-
}
|
326
|
-
}
|
327
|
-
//if link refers to a page on another panel, changePage on that panel
|
328
|
-
else if ($targetPanel && $targetPanel!=$link.parents('div:jqmData(role="panel")')) {
|
329
|
-
var from=$targetPanelActivePage;
|
330
|
-
$.mobile.pageContainer=$targetContainer;
|
331
|
-
$.mobile.changePage(href, {fromPage:from, transition:transitionVal, reverse:reverseVal, pageContainer:$targetContainer, role:role, link:$link});
|
332
|
-
}
|
333
|
-
//if link refers to a page inside the same panel, changePage on that panel
|
334
|
-
else {
|
335
|
-
var from=$currPanelActivePage;
|
336
|
-
$.mobile.pageContainer=$currPanel;
|
337
|
-
var hashChange= (hash == 'false' || hash == 'crumbs')? false : true;
|
338
|
-
$.mobile.changePage(href, {fromPage:from, transition:transitionVal, reverse:reverseVal, changeHash:hashChange, pageContainer:$currPanel, role: role, link: $link});
|
339
|
-
//active page must always point to the active page in main - for history purposes.
|
340
|
-
$.mobile.activePage=$('div:jqmData(id="main") > div.'+$.mobile.activePageClass);
|
341
|
-
}
|
342
|
-
event.preventDefault();
|
343
|
-
event.stopPropagation();
|
344
|
-
});
|
345
|
-
|
346
|
-
//prefetch pages when anchors with data-prefetch are encountered
|
347
|
-
//TODO: insert pageContainer in here!
|
348
|
-
$( document ).delegate( ".ui-page", "pageshow.prefetch", function(){
|
349
|
-
var urls = [],
|
350
|
-
$thisPageContainer = $(this).parents('div:jqmData(role="panel")');
|
351
|
-
$( this ).find( "a:jqmData(prefetch)" ).each(function(){
|
352
|
-
var url = $( this ).attr( "href" ),
|
353
|
-
panel = $(this).jqmData('panel'),
|
354
|
-
container = panel.length? $('div:jqmData(id="'+panel+'")') : $thisPageContainer;
|
355
|
-
if ( url && $.inArray( url, urls ) === -1 ) {
|
356
|
-
urls.push( url );
|
357
|
-
$.mobile.loadPage( url, {pageContainer: container} );
|
358
|
-
}
|
359
|
-
});
|
360
|
-
});
|
361
|
-
|
362
|
-
//DONE: bind hashchange with this plugin
|
363
|
-
//hashchanges are defined only for the main panel - other panels should not support hashchanges to avoid ambiguity
|
364
|
-
$.mobile._handleHashChange = function( hash ) {
|
365
|
-
var to = $.mobile.path.stripHash( hash ),
|
366
|
-
transition = $.mobile.urlHistory.stack.length === 0 ? "none" : undefined,
|
367
|
-
navEvent = new $.Event( "navigate" ),
|
368
|
-
$mainPanel=$('div:jqmData(id="main")'),
|
369
|
-
$mainPanelFirstPage=$mainPanel.children('div:jqmData(role="page"):first'),
|
370
|
-
$mainPanelActivePage=$mainPanel.children('div.ui-page-active'),
|
371
|
-
$menuPanel=$('div:jqmData(id="menu")'),
|
372
|
-
$menuPanelFirstPage=$menuPanel.children('div:jqmData(role="page"):first'),
|
373
|
-
$menuPanelActivePage=$menuPanel.children('div.ui-page-active'),
|
374
|
-
//FIX: temp var for dialogHashKey
|
375
|
-
dialogHashKey = "&ui-state=dialog",
|
376
|
-
|
377
|
-
// default options for the changPage calls made after examining the current state
|
378
|
-
// of the page and the hash
|
379
|
-
changePageOptions = {
|
380
|
-
transition: transition,
|
381
|
-
changeHash: false,
|
382
|
-
fromHashChange: true,
|
383
|
-
pageContainer: $mainPanel
|
384
|
-
};
|
385
|
-
|
386
|
-
if ( 0 === $.mobile.urlHistory.stack.length ) {
|
387
|
-
$.mobile.urlHistory.initialDst = to;
|
388
|
-
}
|
389
|
-
|
390
|
-
// We should probably fire the "navigate" event from those places that make calls to _handleHashChange,
|
391
|
-
// and have _handleHashChange hook into the "navigate" event instead of triggering it here
|
392
|
-
$.mobile.pageContainer.trigger( navEvent );
|
393
|
-
if ( navEvent.isDefaultPrevented() ) {
|
394
|
-
return;
|
395
|
-
}
|
396
|
-
|
397
|
-
if( !$.mobile.hashListeningEnabled || $.mobile.urlHistory.ignoreNextHashChange ){
|
398
|
-
$.mobile.urlHistory.ignoreNextHashChange = false;
|
399
|
-
return;
|
400
|
-
}
|
401
|
-
|
402
|
-
// special case for dialogs
|
403
|
-
if( $.mobile.urlHistory.stack.length > 1 && to.indexOf( dialogHashKey ) > -1 && $.mobile.urlHistory.initialDst !== to ) {
|
404
|
-
|
405
|
-
// If current active page is not a dialog skip the dialog and continue
|
406
|
-
// in the same direction
|
407
|
-
if(!$.mobile.activePage.is( ".ui-dialog" )) {
|
408
|
-
//determine if we're heading forward or backward and continue accordingly past
|
409
|
-
//the current dialog
|
410
|
-
$.mobile.urlHistory.directHashChange({
|
411
|
-
currentUrl: to,
|
412
|
-
isBack: function() { window.history.back(); },
|
413
|
-
isForward: function() { window.history.forward(); }
|
414
|
-
});
|
415
|
-
|
416
|
-
// prevent changepage
|
417
|
-
return;
|
418
|
-
} else {
|
419
|
-
// var setTo = function() { to = $.mobile.urlHistory.getActive().pageUrl; };
|
420
|
-
// if the current active page is a dialog and we're navigating
|
421
|
-
// to a dialog use the dialog objected saved in the stack
|
422
|
-
// urlHistory.directHashChange({ currentUrl: to, isBack: setTo, isForward: setTo });
|
423
|
-
urlHistory.directHashChange({
|
424
|
-
currentUrl: to,
|
425
|
-
|
426
|
-
// regardless of the direction of the history change
|
427
|
-
// do the following
|
428
|
-
either: function( isBack ) {
|
429
|
-
var active = $.mobile.urlHistory.getActive();
|
430
|
-
|
431
|
-
to = active.pageUrl;
|
432
|
-
|
433
|
-
// make sure to set the role, transition and reversal
|
434
|
-
// as most of this is lost by the domCache cleaning
|
435
|
-
$.extend( changePageOptions, {
|
436
|
-
role: active.role,
|
437
|
-
transition: active.transition,
|
438
|
-
reverse: isBack
|
439
|
-
});
|
440
|
-
}
|
441
|
-
});
|
442
|
-
}
|
443
|
-
}
|
444
|
-
|
445
|
-
//if to is defined, load it
|
446
|
-
if ( to ){
|
447
|
-
to = ( typeof to === "string" && !$.mobile.path.isPath( to ) ) ? ( $.mobile.path.makeUrlAbsolute( '#' + to, documentBase ) ) : to;
|
448
|
-
//if this is initial deep-linked page setup, then changePage sidemenu as well
|
449
|
-
if (!$('div.ui-page-active').length) {
|
450
|
-
$menuPanelFirstPage='#'+$menuPanelFirstPage.attr('id');
|
451
|
-
$.mobile.changePage($menuPanelFirstPage, {transition:'none', reverse:true, changeHash:false, fromHashChange:false, pageContainer:$menuPanel});
|
452
|
-
$.mobile.activePage=undefined;
|
453
|
-
}
|
454
|
-
$.mobile.activePage=$mainPanelActivePage.length? $mainPanelActivePage : undefined;
|
455
|
-
$.mobile.changePage(to, changePageOptions );
|
456
|
-
} else {
|
457
|
-
//there's no hash, go to the first page in the main panel.
|
458
|
-
$.mobile.activePage=$mainPanelActivePage? $mainPanelActivePage : undefined;
|
459
|
-
$.mobile.changePage( $mainPanelFirstPage, changePageOptions );
|
460
|
-
}
|
461
|
-
};
|
462
|
-
|
463
|
-
//hashchange event handler
|
464
|
-
$(window).bind( "hashchange", function( e, triggered ) {
|
465
|
-
$.mobile._handleHashChange( location.hash );
|
466
|
-
});
|
467
|
-
|
468
|
-
//set page min-heights to be device specific
|
469
|
-
$( document ).bind( "pageshow.resetPageHeight", function(e){
|
470
|
-
var container = $(e.target).parents('div:jqmData(role="panel")');
|
471
|
-
ResetActivePageHeight(container);
|
472
|
-
});
|
473
|
-
$( window ).bind( "throttledresize.resetPageHeight", ResetActivePageHeight() );
|
474
|
-
|
475
|
-
}; //end _registerInternalEvents
|
476
|
-
|
477
|
-
//DONE: bind orientationchange and resize - the popover
|
478
|
-
_orientationHandler = function(event){
|
479
|
-
var $menu=$('div:jqmData(id="menu")'),
|
480
|
-
$main=$('div:jqmData(id="main")'),
|
481
|
-
$mainHeader=$main.find('div.'+$.mobile.activePageClass+'> div:jqmData(role="header")'),
|
482
|
-
$window=$(window);
|
483
|
-
|
484
|
-
function popoverBtn(header) {
|
485
|
-
if(!header.children('.popover-btn').length){
|
486
|
-
if(header.children('a.ui-btn-'+$.mobile.menuBtnSide).length){
|
487
|
-
header.children('a.ui-btn-'+$.mobile.menuBtnSide).replaceWith('<a class="popover-btn">Menu</a>');
|
488
|
-
header.children('a.popover-btn').addClass('ui-btn-'+$.mobile.menuBtnSide).buttonMarkup();
|
489
|
-
}
|
490
|
-
else{
|
491
|
-
header.prepend('<a class="popover-btn">Menu</a>');
|
492
|
-
header.children('a.popover-btn').addClass('ui-btn-'+$.mobile.menuBtnSide).buttonMarkup()
|
493
|
-
}
|
494
|
-
}
|
495
|
-
}
|
496
|
-
|
497
|
-
function replaceBackBtn(header) {
|
498
|
-
if($.mobile.urlHistory.stack.length > 1 && !header.children('a:jqmData(rel="back")').length && header.jqmData('backbtn')!=false){
|
499
|
-
header.prepend("<a href='#' class='ui-btn-left' data-"+ $.mobile.ns +"rel='back' data-"+ $.mobile.ns +"icon='arrow-l'>Back</a>" );
|
500
|
-
header.children('a:jqmData(rel="back")').buttonMarkup();
|
501
|
-
}
|
502
|
-
};
|
503
|
-
|
504
|
-
function popover(){
|
505
|
-
$menu.addClass('panel-popover')
|
506
|
-
.removeClass('ui-panel-left')
|
507
|
-
.css({'width':$.mobile.menuWidth, 'min-width':$.mobile.menuMinWidth, 'display':'', 'overflow-x':'visible'})
|
508
|
-
.css($.mobile.menuBtnSide, '10px');
|
509
|
-
if(!$menu.children('.popover_triangle').length){
|
510
|
-
$menu.prepend('<div class="popover_triangle" style="'+$.mobile.menuBtnSide+':7px"></div>');
|
511
|
-
}
|
512
|
-
$menu.children('div:jqmData(role="page")').css('min-height', '100%');
|
513
|
-
$main.removeClass('ui-panel-right')
|
514
|
-
.css('width', '');
|
515
|
-
popoverBtn($mainHeader);
|
516
|
-
|
517
|
-
$main.undelegate('div:jqmData(role="page")', 'pagebeforeshow.splitview');
|
518
|
-
$main.delegate('div:jqmData(role="page")','pagebeforeshow.popover', function(){
|
519
|
-
var $thisHeader=$(this).children('div:jqmData(role="header")');
|
520
|
-
popoverBtn($thisHeader);
|
521
|
-
});
|
522
|
-
$( document ).unbind('pageshow.resetPageHeight');
|
523
|
-
// TODO: unbind resetActivePageHeight for popover pages
|
524
|
-
|
525
|
-
};
|
526
|
-
|
527
|
-
function splitView(){
|
528
|
-
$menu.removeClass('panel-popover')
|
529
|
-
.addClass('ui-panel-left')
|
530
|
-
.css({'width':$.mobile.menuWidth, 'min-width':$.mobile.menuMinWidth, 'display':''});
|
531
|
-
$menu.children('.popover_triangle').remove();
|
532
|
-
$main.addClass('ui-panel-right')
|
533
|
-
.width(function(){
|
534
|
-
return $(window).width()-$('div:jqmData(id="menu")').width();
|
535
|
-
});
|
536
|
-
$mainHeader.children('.popover-btn').remove();
|
537
|
-
|
538
|
-
// replaceBackBtn($mainHeader);
|
539
|
-
|
540
|
-
$main.undelegate('div:jqmData(role="page")', 'pagebeforeshow.popover');
|
541
|
-
$main.delegate('div:jqmData(role="page")', 'pagebeforeshow.splitview', function(){
|
542
|
-
var $thisHeader=$(this).children('div:jqmData(role="header")');
|
543
|
-
$thisHeader.children('.popover-btn').remove();
|
544
|
-
// replaceBackBtn($thisHeader);
|
545
|
-
});
|
546
|
-
|
547
|
-
}
|
548
|
-
|
549
|
-
if(event.orientation){
|
550
|
-
if(event.orientation == 'portrait'){
|
551
|
-
popover();
|
552
|
-
}
|
553
|
-
else if(event.orientation == 'landscape') {
|
554
|
-
splitView();
|
555
|
-
}
|
556
|
-
}
|
557
|
-
else if($window.width() < 1280 && $window.width() > 480){
|
558
|
-
popover();
|
559
|
-
}
|
560
|
-
else if($window.width() > 1280){
|
561
|
-
splitView();
|
562
|
-
}
|
563
|
-
};
|
564
|
-
|
565
|
-
$(window).bind('orientationchange', _orientationHandler);
|
566
|
-
$(window).bind('throttledresize', _orientationHandler);
|
567
|
-
|
568
|
-
//popover button click handler - from http://www.cagintranet.com/archive/create-an-ipad-like-dropdown-popover/
|
569
|
-
$(document).on('click', '.popover-btn', function(e){
|
570
|
-
e.preventDefault();
|
571
|
-
$('.panel-popover').fadeToggle('fast');
|
572
|
-
if ($('.popover-btn').hasClass($.mobile.activeBtnClass)) {
|
573
|
-
$('.popover-btn').removeClass($.mobile.activeBtnClass);
|
574
|
-
} else {
|
575
|
-
$('.popover-btn').addClass($.mobile.activeBtnClass);
|
576
|
-
}
|
577
|
-
});
|
578
|
-
|
579
|
-
$(document).on('click', 'body', function(event) {
|
580
|
-
if (!$(event.target).closest('.panel-popover').length && !$(event.target).closest('.popover-btn').length) {
|
581
|
-
$(".panel-popover").stop(true, true).hide();
|
582
|
-
$('.popover-btn').removeClass($.mobile.activeBtnClass);
|
583
|
-
};
|
584
|
-
});
|
585
|
-
|
586
|
-
|
587
|
-
//----------------------------------------------------------------------------------
|
588
|
-
//Other event bindings: scrollview, crumbs, data-context and content height adjustments
|
589
|
-
//----------------------------------------------------------------------------------
|
590
|
-
|
591
|
-
// TODO:cleanup if all is ok
|
592
|
-
// DONE: pageshow binding for scrollview - now using IScroll4! hell yeah!
|
593
|
-
// $('div:jqmData(role="page")').live('pagebeforeshow.scroll', function(event, ui){
|
594
|
-
// if ($.support.touch && !$.support.touchOverflow) {
|
595
|
-
|
596
|
-
// var $page = $(this),
|
597
|
-
// $scrollArea = $page.find('div:jqmData(role="content")');
|
598
|
-
// $scrAreaChildren = $scrollArea.children();
|
599
|
-
|
600
|
-
// if ($scrAreaChildren.length > 1) {
|
601
|
-
// $scrAreaChildren = $scrollArea.wrapInner("<div class='scrollable vertical'></div>").children();
|
602
|
-
// }
|
603
|
-
// $scrollArea.css({ 'width':'auto',
|
604
|
-
// 'height':'auto',
|
605
|
-
// 'overflow':'hidden'});
|
606
|
-
// //TODO: if too many pages are in the DOM that have iscroll on, this might slow down the browser significantly,
|
607
|
-
// //in which case we'll need to destroy() the iscroll as the page hides.
|
608
|
-
// $scrollArea.iscroll();
|
609
|
-
// }
|
610
|
-
// });
|
611
|
-
|
612
|
-
//data-hash 'crumbs' handler
|
613
|
-
//now that data-backbtn is no longer defaulting to true, lets set crumbs to create itself even when backbtn is not available
|
614
|
-
$(document).on("pagebeforeshow.crumbs", 'div:jqmData(role="page")', function(event, data){
|
615
|
-
var $this = $(this);
|
616
|
-
if($this.jqmData('hash') == 'crumbs' || $this.parents('div:jqmData(role="panel")').data('hash') == 'crumbs'){
|
617
|
-
if($this.jqmData('hash')!=false && $this.find('.ui-crumbs').length < 1){
|
618
|
-
var $header=$this.find('div:jqmData(role="header")');
|
619
|
-
backBtn = $this.find('a:jqmData(rel="back")');
|
620
|
-
|
621
|
-
if(data.prevPage.jqmData('url') == $this.jqmData('url')){ //if it's a page refresh
|
622
|
-
var prevCrumb = data.prevPage.find('.ui-crumbs');
|
623
|
-
crumbify(backBtn, prevCrumb.attr('href'), prevCrumb.find('.ui-btn-text').html());
|
624
|
-
}
|
625
|
-
else if($.mobile.urlHistory.stack.length > 0) {
|
626
|
-
var text = data.prevPage.find('div:jqmData(role="header") .ui-title').html();
|
627
|
-
crumbify(backBtn, '#'+data.prevPage.jqmData('url'), text);
|
628
|
-
}
|
629
|
-
else if(backBtn.length && $.mobile.urlHistory.stack.length <= 1) {
|
630
|
-
backBtn.remove();
|
631
|
-
}
|
632
|
-
}
|
633
|
-
}
|
634
|
-
|
635
|
-
function crumbify(button, href, text){
|
636
|
-
if(!button.length) {
|
637
|
-
$this.find('div:jqmData(role="header")').prepend('<a class="ui-crumbs ui-btn-left" data-icon="arrow-l"></a>');
|
638
|
-
button=$header.children('.ui-crumbs').buttonMarkup();
|
639
|
-
}
|
640
|
-
button.removeAttr('data-rel')
|
641
|
-
.jqmData('direction','reverse')
|
642
|
-
.addClass('ui-crumbs')
|
643
|
-
.attr('href',href);
|
644
|
-
button.find('.ui-btn-text').html(text);
|
645
|
-
}
|
646
|
-
});
|
647
|
-
|
648
|
-
//data-context handler - a page with a link that has a data-context attribute will load that page after this page loads
|
649
|
-
//this still needs work - pageTransitionQueue messes everything up.
|
650
|
-
$(document).on('pagechange.context', 'div:jqmData(role="panel")', function(){
|
651
|
-
var $this=$(this),
|
652
|
-
$currPanelActivePage = $this.children('.' + $.mobile.activePageClass),
|
653
|
-
panelContextSelector = $this.jqmData('context'),
|
654
|
-
pageContextSelector = $currPanelActivePage.jqmData('context'),
|
655
|
-
contextSelector= pageContextSelector ? pageContextSelector : panelContextSelector;
|
656
|
-
//if you pass a hash into data-context, you need to specify panel, url and a boolean value for refresh
|
657
|
-
if($.type(contextSelector) === 'object') {
|
658
|
-
var $targetContainer=$('div:jqmData(id="'+contextSelector.panel+'")'),
|
659
|
-
$targetPanelActivePage=$targetContainer.children('div.'+$.mobile.activePageClass),
|
660
|
-
isRefresh = contextSelector.refresh === undefined ? false : contextSelector.refresh;
|
661
|
-
if(($targetPanelActivePage.jqmData('url') == contextSelector.url && contextSelector.refresh)||(!contextSelector.refresh && $targetPanelActivePage.jqmData('url') != contextSelector.url)){
|
662
|
-
$.mobile.changePage(contextSelector.url, options={transition:'fade', changeHash:false, pageContainer:$targetContainer, reloadPage:isRefresh});
|
663
|
-
}
|
664
|
-
}
|
665
|
-
else if(contextSelector && $currPanelActivePage.find(contextSelector).length){
|
666
|
-
$currPanelActivePage.find(contextSelector).trigger('click');
|
667
|
-
}
|
668
|
-
});
|
669
|
-
|
670
|
-
//TODO: cleanup if all is ok
|
671
|
-
// this measures the height of header and footer and sets content to the appropriate height so
|
672
|
-
// that no content is concealed behind header and footer
|
673
|
-
// $('div:jqmData(role="page")').live('pageshow.contentHeight', function(){
|
674
|
-
// var $this=$(this),
|
675
|
-
// $header=$this.children(':jqmData(role="header")'),
|
676
|
-
// $footer=$this.children(':jqmData(role="footer")'),
|
677
|
-
// thisHeaderHeight=$header.css('display') == 'none' ? 0 : $header.outerHeight(),
|
678
|
-
// thisFooterHeight=$footer.css('display') == 'none' ? 0 : $footer.outerHeight();
|
679
|
-
// // $this.children(':jqmData(role="content")').css({'top':thisHeaderHeight, 'bottom':thisFooterHeight});
|
680
|
-
// })
|
681
|
-
|
682
|
-
//this allows panels to change their widths upon changepage - useful for pages that need a different width than the ones provided.
|
683
|
-
// $('div:jqmData(role="page")').live('')
|
684
|
-
}
|
685
|
-
else {
|
686
|
-
//removes all panels so the page behaves like a single panel jqm
|
687
|
-
$(function(){
|
688
|
-
$('div:jqmData(role="panel")').each(function(){
|
689
|
-
var $this = $(this);
|
690
|
-
$this.replaceWith($this.html());
|
691
|
-
})
|
692
|
-
});
|
693
|
-
}
|
694
|
-
});
|
695
|
-
})(jQuery,window);
|