-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
108 lines (86 loc) · 3.28 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
'use strict';
(function() {
var app = {
data: {}
};
var bootstrap = function() {
$(function() {
app.mobileApp = new kendo.mobile.Application(document.body, {
transition: 'slide',
skin: 'nova',
initial: 'components/home/view.html'
});
});
};
$(document).ready(function() {
var navigationShowMoreView = $('#navigation-show-more-view').find('ul'),
allItems = $('#navigation-container-more').find('a'),
navigationShowMoreContent = '';
allItems.each(function(index) {
navigationShowMoreContent += '<li>' + allItems[index].outerHTML + '</li>';
});
navigationShowMoreView.html(navigationShowMoreContent);
});
app.listViewClick = function _listViewClick(item) {
var tabstrip = app.mobileApp.view().footer.find('.km-tabstrip').data('kendoMobileTabStrip');
tabstrip.clear();
};
if (window.cordova) {
document.addEventListener('deviceready', function() {
if (navigator && navigator.splashscreen) {
navigator.splashscreen.hide();
}
bootstrap();
}, false);
} else {
bootstrap();
}
app.keepActiveState = function _keepActiveState(item) {
var currentItem = item;
$('#navigation-container li.active').removeClass('active');
currentItem.addClass('active');
};
window.app = app;
app.isOnline = function() {
if (!navigator || !navigator.connection) {
return true;
} else {
return navigator.connection.type !== 'none';
}
};
app.openLink = function(url) {
if (url.substring(0, 4) === 'geo:' && device.platform === 'iOS') {
url = 'http://maps.apple.com/?ll=' + url.substring(4, url.length);
}
window.open(url, '_system');
if (window.event) {
window.event.preventDefault && window.event.preventDefault();
window.event.returnValue = false;
}
};
/// start appjs functions
/// end appjs functions
app.showFileUploadName = function(itemViewName) {
$('.' + itemViewName).off('change', 'input[type=\'file\']').on('change', 'input[type=\'file\']', function(event) {
var target = $(event.target),
inputValue = target.val(),
fileName = inputValue.substring(inputValue.lastIndexOf('\\') + 1, inputValue.length);
$('#' + target.attr('id') + 'Name').text(fileName);
});
};
app.clearFormDomData = function(formType) {
$.each($('.' + formType).find('input:not([data-bind]), textarea:not([data-bind])'), function(key, value) {
var domEl = $(value),
inputType = domEl.attr('type');
if (domEl.val().length) {
if (inputType === 'file') {
$('#' + domEl.attr('id') + 'Name').text('');
}
domEl.val('');
}
});
};
}());
// START_CUSTOM_CODE_kendoUiMobileApp
// Add custom code here. For more information about custom code, see http://docs.telerik.com/platform/screenbuilder/troubleshooting/how-to-keep-custom-code-changes
// END_CUSTOM_CODE_kendoUiMobileApp