Merge branch 'release/0.0.23'
This commit is contained in:
commit
5a47412a21
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 1.1 MiB |
Binary file not shown.
After Width: | Height: | Size: 411 KiB |
Binary file not shown.
After Width: | Height: | Size: 662 KiB |
Binary file not shown.
After Width: | Height: | Size: 3.5 KiB |
Binary file not shown.
After Width: | Height: | Size: 7.1 KiB |
|
@ -4,3 +4,48 @@
|
|||
box-shadow: 0 0 10px rgba(0, 0, 0, .3);
|
||||
margin: 15px 0;
|
||||
}
|
||||
|
||||
.btn-cadoles {
|
||||
background: #2A80AF;
|
||||
color: #FFF;
|
||||
}
|
||||
.btn-cadoles:hover {
|
||||
background: #1A709F;
|
||||
}
|
||||
.btn-divia {
|
||||
background: #CA0083;
|
||||
color: #FFF;
|
||||
}
|
||||
.btn-divia:hover {
|
||||
background: #D00187;
|
||||
}
|
||||
|
||||
.navbar-default {
|
||||
background-color: rgba(49, 50, 45, .95);
|
||||
border-color: #3e3f3a;
|
||||
}
|
||||
|
||||
#home {
|
||||
background: #93c54b;
|
||||
|
||||
background: -webkit-linear-gradient(0deg, #348F50 10%, #56B4D3 90%); /* Chrome 10+, Saf5.1+ */
|
||||
background: -moz-linear-gradient(0deg, #348F50 10%, #56B4D3 90%); /* FF3.6+ */
|
||||
background: -ms-linear-gradient(0deg, #348F50 10%, #56B4D3 90%); /* IE10 */
|
||||
background: -o-linear-gradient(0deg, #348F50 10%, #56B4D3 90%); /* Opera 11.10+ */
|
||||
background: linear-gradient(0deg, #348F50 10%, #56B4D3 90%); /* W3C */
|
||||
|
||||
background-image: url("bg.jpg");
|
||||
background-size: cover;
|
||||
background-repeat: no-repeat;
|
||||
background-position: center center;
|
||||
}
|
||||
#dijon {
|
||||
color: #FFF;
|
||||
background: rgba(49, 50, 45, .95);
|
||||
}
|
||||
#dijon .navbar-inverse,
|
||||
#dijon .navbar-inverse .btn,
|
||||
#home .navbar-inverse,
|
||||
#home .navbar-inverse .btn {
|
||||
background: none;
|
||||
}
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
alert('I am update');
|
||||
setTimeout(function(){
|
||||
app.flash('<i class="fa fa-arrow-up pull-right" style="margin-right: 10px;"></i> There is a search tool available here', 'info');
|
||||
}, 10000);
|
||||
|
|
|
@ -81,8 +81,56 @@ body {
|
|||
z-index: 1;
|
||||
overflow: hidden;
|
||||
}
|
||||
.momo-image-viewer {
|
||||
z-index: 99999;
|
||||
background-color: black;
|
||||
background-image: url(...);
|
||||
background-size: contain;
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
bottom: 0px;
|
||||
left: 0px;
|
||||
right: 0px;
|
||||
width: 100%;
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
color: #FFF;
|
||||
}
|
||||
.momo-image-viewer .momo-page-content-parent {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
width: 100%;
|
||||
background: -moz-linear-gradient(top, rgba(0,0,0,0) 0%, rgba(0,0,0,0) 1%, rgba(0,0,0,0.9) 50%, rgba(0,0,0,1) 99%, rgba(0,0,0,1) 100%); /* FF3.6+ */
|
||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(0,0,0,0)), color-stop(1%,rgba(0,0,0,0)), color-stop(50%,rgba(0,0,0,0.9)), color-stop(99%,rgba(0,0,0,1)), color-stop(100%,rgba(0,0,0,1))); /* Chrome,Safari4+ */
|
||||
background: -webkit-linear-gradient(top, rgba(0,0,0,0) 0%,rgba(0,0,0,0) 1%,rgba(0,0,0,0.9) 50%,rgba(0,0,0,1) 99%,rgba(0,0,0,1) 100%); /* Chrome10+,Safari5.1+ */
|
||||
background: -o-linear-gradient(top, rgba(0,0,0,0) 0%,rgba(0,0,0,0) 1%,rgba(0,0,0,0.9) 50%,rgba(0,0,0,1) 99%,rgba(0,0,0,1) 100%); /* Opera 11.10+ */
|
||||
background: -ms-linear-gradient(top, rgba(0,0,0,0) 0%,rgba(0,0,0,0) 1%,rgba(0,0,0,0.9) 50%,rgba(0,0,0,1) 99%,rgba(0,0,0,1) 100%); /* IE10+ */
|
||||
background: linear-gradient(to bottom, rgba(0,0,0,0) 0%,rgba(0,0,0,0) 1%,rgba(0,0,0,0.9) 50%,rgba(0,0,0,1) 99%,rgba(0,0,0,1) 100%); /* W3C */
|
||||
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00000000', endColorstr='#000000',GradientType=0 ); /* IE6-9 */
|
||||
}
|
||||
.momo-page iframe {
|
||||
}
|
||||
.momo-frame-wrapper {
|
||||
/*height: 100% !important;*/
|
||||
display: block;
|
||||
}
|
||||
.momo-frame-overlay {
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom:60px;
|
||||
right: 0;
|
||||
width:100%;
|
||||
opacity: .5;
|
||||
background: #FE007F;
|
||||
z-index: 99;
|
||||
pointer-events: auto;
|
||||
}
|
||||
.disable-overlay .momo-frame-overlay {
|
||||
display: none;
|
||||
}
|
||||
.momo-page-wrapper:after {
|
||||
content: " ";
|
||||
|
@ -169,6 +217,9 @@ body {
|
|||
zoom: 1; */
|
||||
}
|
||||
|
||||
img {
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
.momo-page-current,
|
||||
.no-js .pt-page {
|
||||
|
@ -186,6 +237,18 @@ body {
|
|||
.navbar {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.navbar code {
|
||||
color: #79a736;
|
||||
background-color: #222;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
.navbar .navbar-btn.pull-left {
|
||||
padding: 0 14px 0 7px;
|
||||
}
|
||||
.navbar .navbar-btn.pull-right {
|
||||
padding: 0 7px 0 14px;
|
||||
}
|
||||
.navbar .col-xs-8 {
|
||||
display: table;
|
||||
}
|
||||
|
|
|
@ -7,10 +7,11 @@
|
|||
z-index: 10;
|
||||
text-align: center;
|
||||
height: 50px;
|
||||
background: #3e3f3a;
|
||||
/* background: #3e3f3a;*/
|
||||
}
|
||||
|
||||
#ptr .genericon {
|
||||
display: none;
|
||||
opacity: .6;
|
||||
font-size: 34px;
|
||||
width: auto;
|
||||
|
@ -20,6 +21,9 @@
|
|||
transform: rotate(90deg);
|
||||
margin-top: 5px;
|
||||
}
|
||||
.ptr-pulling #ptr .genericon {
|
||||
display: block;
|
||||
}
|
||||
.ptr-refresh #ptr .genericon {
|
||||
-webkit-transform: rotate(270deg);
|
||||
transform: rotate(270deg);
|
||||
|
@ -113,7 +117,7 @@
|
|||
.ptr-loading .momo-page {
|
||||
/*-webkit-transform: translate3d( 0, 50px, 0 );
|
||||
transform: translate3d( 0, 50px, 0 );*/
|
||||
top: 110px;
|
||||
top: 115px;
|
||||
transition: all .25s ease;
|
||||
}
|
||||
.ptr-reset #ptr {
|
||||
|
@ -126,6 +130,6 @@
|
|||
.ptr-loading #ptr {
|
||||
/*-webkit-transform: translate3d( 0, 50px, 0 );
|
||||
transform: translate3d( 0, 50px, 0 );*/
|
||||
top: 60px;
|
||||
top: 65px;
|
||||
transition: all .25s ease;
|
||||
}
|
||||
|
|
164
www/index.html
164
www/index.html
|
@ -25,6 +25,9 @@
|
|||
<meta charset="utf-8" />
|
||||
<meta name="format-detection" content="telephone=no" />
|
||||
<meta name="msapplication-tap-highlight" content="no" />
|
||||
<meta http-Equiv="Cache-Control" Content="no-cache" />
|
||||
<meta http-Equiv="Pragma" Content="no-cache" />
|
||||
<meta http-Equiv="Expires" Content="0" />
|
||||
<!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, target-densitydpi=medium-dpi, user-scalable=0" />
|
||||
<link rel="stylesheet" type="text/css" href="css/index.css" />
|
||||
|
@ -49,17 +52,12 @@
|
|||
</script>
|
||||
|
||||
<script type="text/x-tmpl" id="momo-icon-tmpl">
|
||||
{% if(o.icon.startsWith('http://') ||
|
||||
o.icon.startsWith('https://') ||
|
||||
o.icon.startsWith('file://') ||
|
||||
o.icon.endsWith('.png') ||
|
||||
o.icon.endsWith('.svg') ||
|
||||
o.icon.endsWith('.ico') ||
|
||||
o.icon.endsWith('.jpeg') ||
|
||||
o.icon.endsWith('.jpg')){ %}
|
||||
<img src="{%= o.icon %}" height="{%= o.size %}" width="{%= o.size %}" />
|
||||
{% } else { %}
|
||||
<i class="fa fa-fw {%= o.icon %} {% if(o.size > 20){ %} fa-3x {% } %}"></i>
|
||||
{% if(o.icon){ %}
|
||||
{% if(o.icon.isFramable()){ %}
|
||||
<img src="{%= o.icon %}" height="{%= o.size %}" width="{%= o.size %}" />
|
||||
{% } else { %}
|
||||
<i class="fa fa-fw {%= o.icon %} {% if(o.size > 20){ %} fa-3x {% } %}"></i>
|
||||
{% } %}
|
||||
{% } %}
|
||||
</script>
|
||||
|
||||
|
@ -74,13 +72,29 @@
|
|||
</div>
|
||||
<div class="parent-navbar-brand">
|
||||
<span class="navbar-brand" href="#home">
|
||||
{% if(!(o.titlePersistent || o.meta.titlePersistent || o.id == 'home')){ %}
|
||||
{%# (o.titleSeparator || o.meta.titleSeparator) %}
|
||||
{% } %}
|
||||
<span class="momo-icon">
|
||||
{% var icon = o.icon || o.meta.icon; %}
|
||||
{% var icon = (o.titlePersistent || o.meta.titlePersistent || o.id == 'home') ? o.meta.icon : o.icon || o.meta.icon; %}
|
||||
{% if(icon){ %}
|
||||
{%# tmpl('momo-icon-tmpl', { icon: icon, size: 20, header: true }) %}
|
||||
{% } %}
|
||||
</span>
|
||||
<span class="momo-title">{%= o.title || o.meta.title %}</span>
|
||||
<span class="momo-title">
|
||||
{% if(o.titlePersistent || o.meta.titlePersistent || o.id == 'home'){ %}
|
||||
{%= o.meta.title %}
|
||||
{%# (o.titleSeparator || o.meta.titleSeparator) %}
|
||||
<small>
|
||||
{% if(o.meta.icon && o.icon){ %}
|
||||
{%# tmpl('momo-icon-tmpl', { icon: o.icon, size: 20, header: true }) %}
|
||||
{% } %}
|
||||
{%# o.title %}
|
||||
</small>
|
||||
{% } else { %}
|
||||
{%# (o.title || o.meta.title) %}
|
||||
{% } %}
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</script>
|
||||
|
@ -139,16 +153,34 @@
|
|||
|
||||
<script type="text/x-tmpl" id="momo-list-item-tmpl">
|
||||
<a href="#{%= o.id %}" class="{% if(!o.header){ %} list-group-item {% } %} clearfix">
|
||||
<span class="pull-left">
|
||||
{% if(o.icon){ %}
|
||||
{%# tmpl('momo-icon-tmpl', { icon: o.icon, size: 20 }) %}
|
||||
{% } %}
|
||||
{%= o.title %}
|
||||
</span>
|
||||
{% if(o.external) { %}
|
||||
<i class="fa fa-external-link pull-right"></i>
|
||||
{% } else { %}
|
||||
<i class="fa fa-angle-right pull-right"></i>
|
||||
{% if(o.header){ %}
|
||||
<span class="pull-left">
|
||||
{% if(o.icon){ %}
|
||||
{%# tmpl('momo-icon-tmpl', { icon: o.icon, size: 20 }) %}
|
||||
<span class="hidden-sm hidden-md">
|
||||
{%# o.title %}
|
||||
</span>
|
||||
{% } else { %}
|
||||
{%# o.title %}
|
||||
{% } %}
|
||||
</span>
|
||||
{% if(o.external) { %}
|
||||
<i class="fa fa-external-link pull-right hidden-sm hidden-md"></i>
|
||||
{% } else { %}
|
||||
<i class="fa fa-angle-right pull-right visible-xs-inline"></i>
|
||||
{% } %}
|
||||
{% } else { %}
|
||||
<span class="pull-left">
|
||||
{% if(o.icon){ %}
|
||||
{%# tmpl('momo-icon-tmpl', { icon: o.icon, size: 20 }) %}
|
||||
{% } %}
|
||||
{%# o.title %}
|
||||
</span>
|
||||
{% if(o.external) { %}
|
||||
<i class="fa fa-external-link pull-right"></i>
|
||||
{% } else { %}
|
||||
<i class="fa fa-angle-right pull-right"></i>
|
||||
{% } %}
|
||||
{% } %}
|
||||
</a>
|
||||
</script>
|
||||
|
@ -164,7 +196,7 @@
|
|||
{%# tmpl('momo-icon-tmpl', { icon: o.icon, size: 42 }) %}
|
||||
</div>
|
||||
{% } %}
|
||||
{%= o.title %}
|
||||
{%# o.title %}
|
||||
</a>
|
||||
</div>
|
||||
</script>
|
||||
|
@ -172,33 +204,53 @@
|
|||
<!-- Flash message template -->
|
||||
<script type="text/x-tmpl" id="momo-flash-message-tmpl">
|
||||
<div class="alert alert-{%= o.type %} pt-page-rotateRoomBottomIn">
|
||||
<a href="#momo-blank" onclick="app.utils.removeElement(this.parentElement);" class="pull-right">×</a>
|
||||
{% if(o.type == "success"){ %}<i class="fa fa-fw fa-check"></i>
|
||||
{% } else if(o.type == "info"){ %}<i class="fa fa-fw fa-info-circle"></i>
|
||||
{% } else if(o.type == "warning"){ %}<i class="fa fa-fw fa-exclamation-triangle"></i>
|
||||
{% } else if(o.type == "danger"){ %}<i class="fa fa-fw fa-exclamation-circle"></i>{% } %}
|
||||
{%# o.message %}
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<!-- Update availbable template -->
|
||||
<script type="text/x-tmpl" id="momo-update-available-tmpl">
|
||||
<div class="clearfix">
|
||||
<a href="#momo-update" class="btn btn-success pull-right">
|
||||
<i class="fa fa-download"></i>
|
||||
Mettre à jour
|
||||
</a>
|
||||
<strong>Une nouvelle version est disponible !</strong>
|
||||
</div>
|
||||
<a href="#momo-update" class="btn btn-success pull-right">
|
||||
<i class="fa fa-download"></i>
|
||||
Mettre à jour
|
||||
</a>
|
||||
<strong>Mise à jour disponible !</strong>
|
||||
<p>
|
||||
{%= o.mtime %}
|
||||
</p>
|
||||
<div class="clearfix"></div>
|
||||
</script>
|
||||
|
||||
<!-- Page template -->
|
||||
<script type="text/x-tmpl" id="momo-page-tmpl">
|
||||
{% var displayFooter = true; %}
|
||||
|
||||
<div class="{% if(o.url){ %}momo-frame-wrapper{% } else { %}momo-page-wrapper{% } %} clearfix">
|
||||
<div class="momo-flash-messages"></div>
|
||||
<div class="{% if(o.url){ %}{% } else { %}momo-page-wrapper{% } %} clearfix">
|
||||
|
||||
{% if(!(o.url && o.url.isImage())){ %}
|
||||
<div class="momo-flash-messages"></div>
|
||||
<div class="container-fluid">
|
||||
<section class="momo-page-content">{%# o.content %}</section>
|
||||
</div>
|
||||
{% } else { %}
|
||||
<div class="momo-image-viewer" style="background-image: url('{%# o.url %}');">
|
||||
<div class="momo-flash-messages"></div>
|
||||
<div class="container-fluid momo-page-content-parent">
|
||||
<section class="momo-page-content">{%# o.content %}</section>
|
||||
</div>
|
||||
</div>
|
||||
{% displayFooter = false; %}
|
||||
{% } %}
|
||||
|
||||
<div class="container-fluid">
|
||||
<section class="momo-page-content">{%# o.content %}</section>
|
||||
</div>
|
||||
|
||||
{% if(o.url){ %}
|
||||
<iframe src="{%= o.url %}"></iframe>
|
||||
{% if(o.url && !o.url.isImage()){ %}
|
||||
<iframe src="{%= o.url %}" class="momo-iframe"></iframe>
|
||||
<!--div class="momo-frame-overlay"></div-->
|
||||
{% } %}
|
||||
|
||||
{% if(o.pages){ %}
|
||||
|
@ -235,28 +287,32 @@
|
|||
|
||||
</div>
|
||||
|
||||
<!-- Footer -->
|
||||
<footer class="navbar navbar-inverse momo-footer">
|
||||
<div class="container-fluid clearfix">
|
||||
<div class="row">
|
||||
<div class="col-xs-6 navbar-btn text-left">
|
||||
<a href="https://dev.entrouvert.org/projects/momo/"
|
||||
class="btn btn-success pull-left momo-repo"
|
||||
target="_system"
|
||||
onclick="javascript:app.utils.onExternalLinkClick()">Momo repository</a>
|
||||
</div>
|
||||
<div class="col-xs-6 navbar-btn text-right">
|
||||
<a href="mailto:{%= o.meta.contact %}"
|
||||
class="btn btn-success pull-right momo-contact">{%= o.meta.contact %}</a>
|
||||
{% if(displayFooter){ %}
|
||||
<!-- Footer -->
|
||||
<footer class="navbar navbar-inverse momo-footer">
|
||||
<div class="container-fluid clearfix">
|
||||
<div class="row">
|
||||
<div class="col-xs-6 navbar-btn text-left">
|
||||
<a href="https://dev.entrouvert.org/projects/momo/"
|
||||
class="btn btn-success pull-left momo-repo"
|
||||
target="_system"
|
||||
onclick="javascript:app.utils.onExternalLinkClick()">Momo repository</a>
|
||||
</div>
|
||||
<div class="col-xs-6 navbar-btn text-right">
|
||||
<a href="mailto:{%= o.meta.contact %}"
|
||||
class="btn btn-success pull-right momo-contact">{%= o.meta.contact %}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</footer>
|
||||
{% } %}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" src="cordova.js"></script>
|
||||
<!--script type="text/javascript" src="js/jquery-1.11.3.min.js"></script-->
|
||||
<!--script type="text/javascript" src="js/createTouchEvent.js"></script-->
|
||||
<script type="text/javascript" src="js/polyfill/Promise.min.js"></script>
|
||||
<script type="text/javascript" src="js/polyfill/transition-end.min.js"></script>
|
||||
<script type="text/javascript" src="js/tmpl.min.js"></script>
|
||||
|
|
Binary file not shown.
|
@ -0,0 +1,68 @@
|
|||
var TouchEvent = (function() {
|
||||
|
||||
var ua = /iPhone|iP[oa]d/.test(navigator.userAgent) ? 'iOS' : /Android/.test(navigator.userAgent) ? 'Android' : 'PC';
|
||||
|
||||
//document.addEventListener('DOMContentLoaded', function(event) {
|
||||
//
|
||||
// if(ua === 'PC') {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// document.addEventListener('touchstart', function() {
|
||||
// console.log('Touch!');
|
||||
// }, false);
|
||||
//
|
||||
// var touchEvent = create();
|
||||
//
|
||||
// setTimeout(function() {
|
||||
// document.dispatchEvent(touchEvent);
|
||||
// }, 3000);
|
||||
//
|
||||
//}, false);
|
||||
|
||||
function create(option) {
|
||||
var option = option || {};
|
||||
var param = {
|
||||
type: 'touchstart',
|
||||
canBubble: true,
|
||||
cancelable: true,
|
||||
view: window,
|
||||
detail: 0,
|
||||
screenX: 0,
|
||||
screenY: 0,
|
||||
clientX: 0,
|
||||
clientY: 0,
|
||||
ctrlKey: false,
|
||||
altKey: false,
|
||||
shiftKey: false,
|
||||
metaKey: false,
|
||||
touches: 0,
|
||||
targetTouches: 0,
|
||||
changedTouches: 0,
|
||||
scale: 0,
|
||||
rotation: 0,
|
||||
touchItem: 0
|
||||
};
|
||||
|
||||
var event = document.createEvent('TouchEvent');
|
||||
|
||||
for(var i in param) {
|
||||
if(param.hasOwnProperty(i)) {
|
||||
param[i] = option[i] !== undefined ? option[i] : param[i];
|
||||
}
|
||||
}
|
||||
|
||||
if(ua === 'Android') {
|
||||
event.initUIEvent(param.touchItem, param.touchItem, param.touchItem, param.type, param.view, param.screenX, param.screenY, param.clientX, param.clientY, param.ctrlKey, param.altKey, param.shiftKey, param.metaKey);
|
||||
} else {
|
||||
event.initUIEvent(param.type, param.canBubble, param.cancelable, param.view, param.detail, param.screenX, param.screenY, param.clientX, param.clientY, param.ctrlKey, param.altKey, param.shiftKey, param.metaKey, param.touches, param.targetTouches, param.changedTouches, param.scale, param.rotation);
|
||||
}
|
||||
|
||||
return event;
|
||||
}
|
||||
|
||||
return {
|
||||
create: create
|
||||
}
|
||||
|
||||
})();
|
File diff suppressed because one or more lines are too long
104
www/js/index.js
104
www/js/index.js
|
@ -40,11 +40,14 @@ var app = {
|
|||
manifest: {
|
||||
meta: {
|
||||
'title': 'Momo Application',
|
||||
'icon': 'icon.png',
|
||||
'contact': 'contact@cadoles.com',
|
||||
'manifestUrl': 'index.json',
|
||||
'assetsUrl': 'assets.zip',
|
||||
'updateFreq': 0,
|
||||
'content': tmpl('momo-first-launch-tmpl')
|
||||
'content': tmpl('momo-first-launch-tmpl'),
|
||||
'titlePersitent': true,
|
||||
'titleSeparator': "<br>"
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -168,7 +171,7 @@ var app = {
|
|||
reject();
|
||||
} else {
|
||||
if(updateAvailable){
|
||||
app.flash(tmpl('momo-update-available-tmpl', {}), 'success');
|
||||
app.flash(tmpl('momo-update-available-tmpl', { mtime: app.utils.formatDate(mtime) }), 'success');
|
||||
app.utils.setLoadingMsg("Mise à jour disponible !");
|
||||
} else {
|
||||
app.utils.setLoadingMsg("Aucunes nouvelles mises à jour");
|
||||
|
@ -233,16 +236,20 @@ var app = {
|
|||
|
||||
// Store manifest if parsable
|
||||
localStorage.setItem("momo-manifest", manifestResponse);
|
||||
|
||||
// Reload if new manifest url
|
||||
if(url != app.manifest.meta.manifestUrl){
|
||||
app.loadManifest(resolve, reject);
|
||||
} else {
|
||||
if(typeof resolve === "function")
|
||||
resolve();
|
||||
}
|
||||
} catch(e) {
|
||||
if(DEBUG) console.log('Cannot parse application manifest '+url);
|
||||
}
|
||||
app.flash('Le manifest JSON comporte des erreurs', 'danger');
|
||||
if(typeof reject === "function")
|
||||
reject();
|
||||
|
||||
// Reload if new manifest url
|
||||
if(url != app.manifest.meta.manifestUrl){
|
||||
app.loadManifest(resolve, reject);
|
||||
} else {
|
||||
if(typeof resolve === "function")
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -421,7 +428,8 @@ var app = {
|
|||
document.getElementsByTagName("head")[0].appendChild(link);
|
||||
document.getElementsByTagName("head")[0].appendChild(script);
|
||||
|
||||
resolve();
|
||||
if(typeof resolve === 'function')
|
||||
resolve();
|
||||
};
|
||||
|
||||
if(typeof FileTransfer !== 'undefined' && typeof zip !== 'undefined'){
|
||||
|
@ -453,9 +461,12 @@ var app = {
|
|||
|
||||
// Render Homepage
|
||||
app.render(app.manifest);
|
||||
|
||||
// Navigate to home
|
||||
app.navigate('home', false, function(){
|
||||
if(typeof resolve == 'function')
|
||||
resolve();
|
||||
|
||||
// Append assets
|
||||
app.appendAssets(resolve, reject);
|
||||
});
|
||||
|
||||
// Listen for search form submission
|
||||
|
@ -472,7 +483,7 @@ var app = {
|
|||
data = app.utils.extend(app.defaultPage, data);
|
||||
|
||||
// Generate a page ID
|
||||
var id = data.id = data.id ? data.id : (data.title ? app.utils.hyphenate(data.title) : '_' + Math.random().toString(36).substr(2, 9));
|
||||
var id = data.id = data.id ? data.id : (data.title ? app.utils.hyphenate(data.title.stripTags()) : '_' + Math.random().toString(36).substr(2, 9));
|
||||
|
||||
// Make sure id is unique
|
||||
var i = 1;
|
||||
|
@ -735,6 +746,11 @@ var app = {
|
|||
}, 1000);
|
||||
};
|
||||
return app.update(cb, cb);
|
||||
return window.history.back();
|
||||
} else
|
||||
if(page == 'momo-blank'){
|
||||
return window.location.replace(app.hashHistory[app.hashHistory.length-1]);
|
||||
return window.history.back();
|
||||
}
|
||||
|
||||
if(!app.pages.hasOwnProperty(page)){
|
||||
|
@ -873,6 +889,8 @@ var app = {
|
|||
|
||||
app.loadManifest(
|
||||
function(){
|
||||
localStorage.setItem('momo-manifest-mtime', app.manifestMtime);
|
||||
localStorage.setItem('momo-assets-mtime', app.assetsMtime);
|
||||
loadAssets(resolve, reject);
|
||||
},
|
||||
function(){
|
||||
|
@ -916,14 +934,17 @@ var app = {
|
|||
} else {
|
||||
app.navigate(app.current_page);
|
||||
}
|
||||
|
||||
localStorage.setItem('momo-manifest-mtime', app.manifestMtime);
|
||||
localStorage.setItem('momo-assets-mtime', app.assetsMtime);
|
||||
},
|
||||
|
||||
|
||||
// Various Javascript Helpers
|
||||
utils: {
|
||||
|
||||
removeElement: function($el){
|
||||
$el.parentElement.removeChild($el);
|
||||
return false;
|
||||
},
|
||||
|
||||
setLoadingMsg: function(text){
|
||||
var elements = document.getElementsByClassName("momo-loading-text");
|
||||
for (var i = 0; i < elements.length; i++)
|
||||
|
@ -1083,17 +1104,56 @@ var app = {
|
|||
}
|
||||
}
|
||||
xhr.send();
|
||||
},
|
||||
|
||||
formatDate: function(date){
|
||||
var d = date,
|
||||
minutes = d.getMinutes(),//.toString().length == 1 ? '0'+d.getMinutes() : d.getMinutes(),
|
||||
hours = d.getHours(),//.toString().length == 1 ? '0'+d.getHours() : d.getHours(),
|
||||
//ampm = d.getHours() >= 12 ? 'pm' : 'am',
|
||||
//months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],
|
||||
//days = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];
|
||||
months = ['Janvier','Février','Mars','Avril','Mai','Juin','Jullet','Août','Septempbre','Octobre','Novembre','Décembre'],
|
||||
days = ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'];
|
||||
//return days[d.getDay()]+' '+months[d.getMonth()]+' '+d.getDate()+' '+d.getFullYear()+' '+hours+':'+minutes;//+ampm;
|
||||
return days[d.getDay()]+' '+d.getDate()+' '+months[d.getMonth()]+' '+d.getFullYear()+' '+hours+':'+minutes;//+ampm;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (typeof String.prototype.startsWith != 'function') {
|
||||
String.prototype.startsWith = function (str){
|
||||
return this.slice(0, str.length) == str;
|
||||
};
|
||||
String.prototype.startsWith = function (str){
|
||||
return this.slice(0, str.length) == str;
|
||||
};
|
||||
}
|
||||
if (typeof String.prototype.endsWith != 'function') {
|
||||
String.prototype.endsWith = function (str){
|
||||
return this.slice(-str.length) == str;
|
||||
};
|
||||
String.prototype.endsWith = function (str){
|
||||
return this.slice(-str.length) == str;
|
||||
};
|
||||
}
|
||||
if (typeof String.prototype.stripTags != 'function') {
|
||||
String.prototype.stripTags = function (){
|
||||
return this.replace(/(<([^>]+)>)/ig,"");
|
||||
};
|
||||
}
|
||||
if (typeof String.prototype.isImage != 'function') {
|
||||
String.prototype.isImage = function (){
|
||||
return this.endsWith('.png') ||
|
||||
this.endsWith('.svg') ||
|
||||
this.endsWith('.ico') ||
|
||||
this.endsWith('.jpeg') ||
|
||||
this.endsWith('.jpg');
|
||||
};
|
||||
}
|
||||
if (typeof String.prototype.isUrl != 'function') {
|
||||
String.prototype.isUrl = function (){
|
||||
return this.startsWith('http://') ||
|
||||
this.startsWith('https://') ||
|
||||
this.startsWith('file://');
|
||||
};
|
||||
}
|
||||
if (typeof String.prototype.isFramable != 'function') {
|
||||
String.prototype.isFramable = function (){
|
||||
return this.isImage() || this.isUrl();
|
||||
};
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
110
www/js/wptr.js
110
www/js/wptr.js
|
@ -69,18 +69,18 @@ var WebPullToRefresh = (function () {
|
|||
}
|
||||
|
||||
var iframes = options.contentEl.getElementsByTagName('iframe');
|
||||
var overlays = options.contentEl.getElementsByClassName('momo-frame-overlay');
|
||||
var wrappers = options.contentEl.getElementsByClassName('momo-frame-wrapper');
|
||||
|
||||
if(iframes.length > 0){
|
||||
var iframe = iframes[0];
|
||||
var oE1 = iframe.contentWindow;
|
||||
if(window.pageYOffset==undefined)
|
||||
{
|
||||
oE1= (oE1.document.documentElement) ? oE1.document.documentElement : oE1=document.body;
|
||||
}
|
||||
options.contentEl = iframe;
|
||||
if(iframes.length > 0) {
|
||||
options.iframe = iframes[0];
|
||||
options.overlay = overlays[0];
|
||||
options.wrapper = wrappers[0];
|
||||
// FIXME; Touch events on iframe (IMPOZZZZIBLE !!!)
|
||||
//options.overlay.addEventListener('touchstart', _onTouchStart);
|
||||
//options.overlay.addEventListener('touchend', _onTouchEnd);
|
||||
}
|
||||
|
||||
|
||||
options.h = new Hammer( options.contentEl, { touchAction: 'pan-y' } );
|
||||
|
||||
options.h.get( 'pan' ).set( { direction: Hammer.DIRECTION_ALL } );
|
||||
|
@ -98,6 +98,98 @@ var WebPullToRefresh = (function () {
|
|||
options.h.destroy();
|
||||
};
|
||||
|
||||
var sendTouchEvent = function(element, eventType, touchList) {
|
||||
var touchEvent = document.createEvent("TouchEvent");
|
||||
|
||||
var canBubble = true;
|
||||
var cancelable = true;
|
||||
var view = window;
|
||||
var detail = null; // not sure what this is
|
||||
var screenX = 0;
|
||||
var screenY = 0;
|
||||
var clientX = 0;
|
||||
var clientY = 0;
|
||||
var ctrlKey = false;
|
||||
var altKey = false;
|
||||
var shiftKey = false;
|
||||
var metaKey = false;
|
||||
var touches = touchList;
|
||||
var targetTouches = touchList;
|
||||
var changedTouches = touchList;
|
||||
var scale = 1;
|
||||
var rotation = 0;
|
||||
|
||||
if (true /*browser.usesAndroidInitTouchEventParameterOrder()*/) {
|
||||
touchEvent.initTouchEvent(
|
||||
touches, targetTouches, changedTouches,
|
||||
eventType,
|
||||
view,
|
||||
screenX, screenY,
|
||||
clientX, clientY,
|
||||
ctrlKey, altKey, shiftKey, metaKey
|
||||
);
|
||||
}
|
||||
else {
|
||||
touchEvent.initTouchEvent(
|
||||
eventType,
|
||||
canBubble,
|
||||
cancelable,
|
||||
view,
|
||||
detail,
|
||||
screenX, screenY,
|
||||
clientX, clientY,
|
||||
ctrlKey, altKey, shiftKey, metaKey,
|
||||
touches, targetTouches, changedTouches,
|
||||
scale, rotation
|
||||
);
|
||||
}
|
||||
|
||||
var eventData = new jQuery.Event("event");
|
||||
eventData.type = eventType;
|
||||
eventData.originalEvent = touchEvent;
|
||||
$(element).trigger(eventData);
|
||||
};
|
||||
|
||||
var _onTouchStart = function(e){
|
||||
bodyClass.add( 'disable-overlay' );
|
||||
//e.preventDefault();
|
||||
//e.stopImmediatePropagation();
|
||||
var _e = TouchEvent.create(e);
|
||||
app.utils.extend(_e, {
|
||||
originalEvent : {
|
||||
touches: e.touches,
|
||||
changedTouches: e.changedTouches,
|
||||
targetTouches: e.targetTouches,
|
||||
pageX: e.pageX,
|
||||
pageY: e.pageY
|
||||
}
|
||||
});
|
||||
options.overlay.removeEventListener('touchstart', _onTouchStart);
|
||||
//options.iframe.dispatchEvent(_e);
|
||||
try {
|
||||
sendTouchEvent(options.iframe.contentWindow, 'touchstart', e.targetTouches);
|
||||
} catch(e) {}
|
||||
options.overlay.addEventListener('touchstart', _onTouchStart);
|
||||
};
|
||||
|
||||
var _onTouchEnd = function(e){
|
||||
//e.preventDefault();
|
||||
//e.stopImmediatePropagation();
|
||||
var _e = TouchEvent.create(e);
|
||||
_e.touches = e.touches;
|
||||
_e.changedTouches = e.changedTouches;
|
||||
_e.targetTouches = e.targetTouches;
|
||||
_e.pageX = e.pageX;
|
||||
_e.pageY = e.pageY;
|
||||
options.overlay.removeEventListener('touchend', _onTouchEnd);
|
||||
//options.iframe.dispatchEvent(_e);
|
||||
try {
|
||||
sendTouchEvent(options.iframe.contentWindow, 'touchend', e.targetTouches);
|
||||
} catch(e) {}
|
||||
options.overlay.addEventListener('touchend', _onTouchEnd);
|
||||
bodyClass.remove( 'disable-overlay' );
|
||||
};
|
||||
|
||||
/**
|
||||
* Determine whether pan events should apply based on scroll position on panstart
|
||||
*
|
||||
|
|
Reference in New Issue