Merge branch 'release/0.0.8'
Conflicts: www/index.html www/js/index.js
This commit is contained in:
commit
1715186d46
|
@ -0,0 +1,55 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<widget id="com.cadoles.momo" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0">
|
||||
<name>Momo</name>
|
||||
<description>
|
||||
Momo template that serves application from JSON manifest
|
||||
</description>
|
||||
<author email="contact@cadoles.com" href="http://cadoles.com">
|
||||
Cadoles Team
|
||||
</author>
|
||||
<content src="index.html" />
|
||||
<preference name="permissions" value="none" />
|
||||
<preference name="orientation" value="default" />
|
||||
<preference name="target-device" value="universal" />
|
||||
<preference name="fullscreen" value="true" />
|
||||
<preference name="webviewbounce" value="true" />
|
||||
<preference name="prerendered-icon" value="true" />
|
||||
<preference name="stay-in-webview" value="false" />
|
||||
<preference name="ios-statusbarstyle" value="black-opaque" />
|
||||
<preference name="detect-data-types" value="true" />
|
||||
<preference name="exit-on-suspend" value="false" />
|
||||
<preference name="show-splash-screen-spinner" value="true" />
|
||||
<preference name="auto-hide-splash-screen" value="true" />
|
||||
<preference name="disable-cursor" value="false" />
|
||||
<preference name="android-minSdkVersion" value="7" />
|
||||
<preference name="android-installLocation" value="auto" />
|
||||
<gap:plugin name="org.apache.cordova.file" />
|
||||
<gap:plugin name="org.apache.cordova.file-transfer" />
|
||||
<gap:plugin name="org.apache.cordova.inappbrowser" />
|
||||
<icon src="icon.png" />
|
||||
<icon gap:platform="android" gap:qualifier="ldpi" src="www/res/icon/android/icon-36-ldpi.png" />
|
||||
<icon gap:platform="android" gap:qualifier="mdpi" src="www/res/icon/android/icon-48-mdpi.png" />
|
||||
<icon gap:platform="android" gap:qualifier="hdpi" src="www/res/icon/android/icon-72-hdpi.png" />
|
||||
<icon gap:platform="android" gap:qualifier="xhdpi" src="www/res/icon/android/icon-96-xhdpi.png" />
|
||||
<icon gap:platform="blackberry" src="www/res/icon/blackberry/icon-80.png" />
|
||||
<icon gap:platform="blackberry" gap:state="hover" src="www/res/icon/blackberry/icon-80.png" />
|
||||
<icon gap:platform="ios" height="57" src="www/res/icon/ios/icon-57.png" width="57" />
|
||||
<icon gap:platform="ios" height="72" src="www/res/icon/ios/icon-72.png" width="72" />
|
||||
<icon gap:platform="ios" height="114" src="www/res/icon/ios/icon-57-2x.png" width="114" />
|
||||
<icon gap:platform="ios" height="144" src="www/res/icon/ios/icon-72-2x.png" width="144" />
|
||||
<icon gap:platform="webos" src="www/res/icon/webos/icon-64.png" />
|
||||
<icon gap:platform="winphone" src="www/res/icon/windows-phone/icon-48.png" />
|
||||
<icon gap:platform="winphone" gap:role="background" src="www/res/icon/windows-phone/icon-173-tile.png" />
|
||||
<gap:splash gap:platform="android" gap:qualifier="port-ldpi" src="www/res/screen/android/screen-ldpi-portrait.png" />
|
||||
<gap:splash gap:platform="android" gap:qualifier="port-mdpi" src="www/res/screen/android/screen-mdpi-portrait.png" />
|
||||
<gap:splash gap:platform="android" gap:qualifier="port-hdpi" src="www/res/screen/android/screen-hdpi-portrait.png" />
|
||||
<gap:splash gap:platform="android" gap:qualifier="port-xhdpi" src="www/res/screen/android/screen-xhdpi-portrait.png" />
|
||||
<gap:splash gap:platform="blackberry" src="www/res/screen/blackberry/screen-225.png" />
|
||||
<gap:splash gap:platform="ios" height="480" src="www/res/screen/ios/screen-iphone-portrait.png" width="320" />
|
||||
<gap:splash gap:platform="ios" height="960" src="www/res/screen/ios/screen-iphone-portrait-2x.png" width="640" />
|
||||
<gap:splash gap:platform="ios" height="1136" src="www/res/screen/ios/screen-iphone-portrait-568h-2x.png" width="640" />
|
||||
<gap:splash gap:platform="ios" height="1024" src="www/res/screen/ios/screen-ipad-portrait.png" width="768" />
|
||||
<gap:splash gap:platform="ios" height="768" src="www/res/screen/ios/screen-ipad-landscape.png" width="1024" />
|
||||
<gap:splash gap:platform="winphone" src="www/res/screen/windows-phone/screen-portrait.jpg" />
|
||||
<access origin="*" />
|
||||
</widget>
|
|
@ -26,11 +26,7 @@
|
|||
<meta name="format-detection" content="telephone=no" />
|
||||
<meta name="msapplication-tap-highlight" content="no" />
|
||||
<!-- 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" />
|
||||
<meta charset="utf-8" />
|
||||
<meta name="format-detection" content="telephone=no" />
|
||||
<meta name="msapplication-tap-highlight" content="no" />
|
||||
<meta name="viewport" content="user-scalable=yes, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
|
||||
<link rel="stylesheet" type="text/css" href="css/index.css" />
|
||||
<link rel="stylesheet" href="css/responsive-nav.css">
|
||||
<title class="momo-title">Loading</title>
|
||||
|
@ -101,7 +97,7 @@
|
|||
<form id="momo-search" class="navbar-form navbar-right" role="search">
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" placeholder="Rechercher">
|
||||
<input id="momo-search-input" name="searchInput" type="text" class="form-control" placeholder="Rechercher">
|
||||
<div class="input-group-btn">
|
||||
<button type="submit" class="btn btn-success">
|
||||
<i class="fa fa-search"></i>
|
||||
|
@ -218,6 +214,9 @@
|
|||
|
||||
<script type="text/javascript" src="cordova.js"></script>
|
||||
<script type="text/javascript" src="js/tmpl.min.js"></script>
|
||||
<script type="text/javascript" src="js/lunr.min.js"></script>
|
||||
<script type="text/javascript" src="js/lunr.stemmer.support.min.js"></script>
|
||||
<script type="text/javascript" src="js/lunr.fr.min.js"></script>
|
||||
<script type="text/javascript" src="js/fastclick.js"></script>
|
||||
<script type="text/javascript" src="js/responsive-nav.js"></script>
|
||||
<script type="text/javascript" src="js/index.js"></script>
|
||||
|
|
|
@ -83,10 +83,25 @@ var app = {
|
|||
|
||||
// Device ready callback
|
||||
onDeviceReady: function() {
|
||||
app.initIndex();
|
||||
app.loadManifest();
|
||||
FastClick.attach(document.body);
|
||||
},
|
||||
|
||||
// Initialize search engine index
|
||||
initIndex: function(){
|
||||
app.index = lunr(function () {
|
||||
this.use(lunr.fr);
|
||||
this.field('title', {boost: 10})
|
||||
this.field('body')
|
||||
this.ref('id')
|
||||
this.pipeline.add(function (token, tokenIndex, tokens) {
|
||||
if(token.length > 2)
|
||||
return app.utils.replaceAccents(token);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
// JSON Manifest loading function
|
||||
loadManifest: function(){
|
||||
if(DEBUG) console.log('load '+JSON.stringify(app.manifest));
|
||||
|
@ -296,6 +311,9 @@ var app = {
|
|||
|
||||
// Default route to home
|
||||
app.manifest.id = app.current_page = 'home';
|
||||
|
||||
// Dev page refresh : redirect to home
|
||||
window.location.hash = '#home'
|
||||
|
||||
// Import Scripts & Styles
|
||||
app.appendAssets(function(){
|
||||
|
@ -306,6 +324,9 @@ var app = {
|
|||
// Render Homepage
|
||||
app.render(app.manifest);
|
||||
|
||||
// Listen for search form submission
|
||||
var $form = document.getElementById('momo-search');
|
||||
$form.addEventListener('submit', app.onSearchSubmit, false);
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -349,6 +370,13 @@ var app = {
|
|||
app.pages[data.id].seealso[i] = app.registerPage(page, false);
|
||||
}
|
||||
}
|
||||
|
||||
// Index page for search engine
|
||||
app.index.add({
|
||||
id: data.id,
|
||||
title: data.title,
|
||||
body: data.content
|
||||
});
|
||||
|
||||
return data.id;
|
||||
} else
|
||||
|
@ -373,7 +401,7 @@ var app = {
|
|||
}
|
||||
|
||||
// Render navigation
|
||||
var nav = responsiveNav(".momo-nav-collapse", { // Selector
|
||||
app.nav = responsiveNav(".momo-nav-collapse", { // Selector
|
||||
animate: true, // Boolean: Use CSS3 transitions, true or false
|
||||
transition: 284, // Integer: Speed of the transition, in milliseconds
|
||||
//label: "Menu", // String: Label for the navigation toggle
|
||||
|
@ -414,29 +442,6 @@ var app = {
|
|||
// Change page header
|
||||
document.getElementById("momo-header").innerHTML = tmpl("momo-header-tmpl", data);
|
||||
|
||||
// Change page title
|
||||
//var elements = document.getElementsByClassName("momo-title");
|
||||
//for (var i = 0; i < elements.length; i++)
|
||||
// elements[i].innerHTML = data.title;
|
||||
|
||||
//// Change page icon
|
||||
//var elements = document.getElementsByClassName("momo-icon");
|
||||
//data.icon = data.icon || data.meta.icon;
|
||||
//var $icon = document.createElement('img');
|
||||
//$icon.height = 20;
|
||||
//$icon.width = 20;
|
||||
//$icon.src = data.icon;
|
||||
//for (var i = 0; i < elements.length; i++)
|
||||
// elements[i].innerHTML = data.title;
|
||||
|
||||
//// Display ot not back btn
|
||||
//var elements = document.getElementsByClassName("momo-back-btn");
|
||||
//for (var i = 0; i < elements.length; i++)
|
||||
// if(data.id == 'home')
|
||||
// elements[i].classList.add('hidden');
|
||||
// else
|
||||
// elements[i].classList.remove('hidden');
|
||||
|
||||
// Render Page
|
||||
return tmpl("momo-page-tmpl", data);
|
||||
} else
|
||||
|
@ -572,6 +577,52 @@ var app = {
|
|||
}
|
||||
},
|
||||
|
||||
onSearchSubmit: function(e){
|
||||
// Stop form default action
|
||||
e.preventDefault();
|
||||
//e.stopPropagation();
|
||||
|
||||
// Get search input
|
||||
var $searchInput = document.getElementById('momo-search-input');
|
||||
var searchInput = app.utils.replaceAccents($searchInput.value);
|
||||
var id = "search-"+app.utils.hyphenate(searchInput);
|
||||
|
||||
// Close navigation + Keyboard
|
||||
app.nav.close();
|
||||
$searchInput.value = '';
|
||||
$searchInput.blur();
|
||||
|
||||
// If search query doesn't exist
|
||||
if(!document.getElementById(id)){
|
||||
|
||||
// Get search results
|
||||
var results = app.index.search(searchInput);
|
||||
|
||||
// Register new search results page
|
||||
app.pages[id] = {
|
||||
id: id,
|
||||
icon: "fa fa-search",
|
||||
title: 'Recherche "'+searchInput+'"',
|
||||
content: results.length ? null : '<div class="well text-center text-muted">Aucun resultat</div>',
|
||||
pages: results.map(function(item){
|
||||
return item.ref;
|
||||
})
|
||||
};
|
||||
|
||||
// Generate result page view
|
||||
var $page = document.createElement('div');
|
||||
$page.id = id
|
||||
$page.className = "momo-page";
|
||||
$page.innerHTML = app.renderPage(app.pages[id]);
|
||||
document.getElementById('momo-pages').appendChild($page);
|
||||
}
|
||||
|
||||
// Navigate to search result page
|
||||
window.location.hash = "#"+id;
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
// Various Javascript Helpers
|
||||
utils: {
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -0,0 +1 @@
|
|||
!function(r,t){"function"==typeof define&&define.amd?define(t):"object"==typeof exports?module.exports=t():t()(r.lunr)}(this,function(){return function(r){r.stemmerSupport={Among:function(r,t,i,s){if(this.toCharArray=function(r){for(var t=r.length,i=new Array(t),s=0;t>s;s++)i[s]=r.charCodeAt(s);return i},!r&&""!=r||!t&&0!=t||!i)throw"Bad Among initialisation: s:"+r+", substring_i: "+t+", result: "+i;this.s_size=r.length,this.s=this.toCharArray(r),this.substring_i=t,this.result=i,this.method=s},SnowballProgram:function(){var r;return{bra:0,ket:0,limit:0,cursor:0,limit_backward:0,setCurrent:function(t){r=t,this.cursor=0,this.limit=t.length,this.limit_backward=0,this.bra=this.cursor,this.ket=this.limit},getCurrent:function(){var t=r;return r=null,t},in_grouping:function(t,i,s){if(this.cursor<this.limit){var e=r.charCodeAt(this.cursor);if(s>=e&&e>=i&&(e-=i,t[e>>3]&1<<(7&e)))return this.cursor++,!0}return!1},in_grouping_b:function(t,i,s){if(this.cursor>this.limit_backward){var e=r.charCodeAt(this.cursor-1);if(s>=e&&e>=i&&(e-=i,t[e>>3]&1<<(7&e)))return this.cursor--,!0}return!1},out_grouping:function(t,i,s){if(this.cursor<this.limit){var e=r.charCodeAt(this.cursor);if(e>s||i>e)return this.cursor++,!0;if(e-=i,!(t[e>>3]&1<<(7&e)))return this.cursor++,!0}return!1},out_grouping_b:function(t,i,s){if(this.cursor>this.limit_backward){var e=r.charCodeAt(this.cursor-1);if(e>s||i>e)return this.cursor--,!0;if(e-=i,!(t[e>>3]&1<<(7&e)))return this.cursor--,!0}return!1},eq_s:function(t,i){if(this.limit-this.cursor<t)return!1;for(var s=0;t>s;s++)if(r.charCodeAt(this.cursor+s)!=i.charCodeAt(s))return!1;return this.cursor+=t,!0},eq_s_b:function(t,i){if(this.cursor-this.limit_backward<t)return!1;for(var s=0;t>s;s++)if(r.charCodeAt(this.cursor-t+s)!=i.charCodeAt(s))return!1;return this.cursor-=t,!0},find_among:function(t,i){for(var s=0,e=i,n=this.cursor,u=this.limit,o=0,h=0,c=!1;;){for(var f=s+(e-s>>1),a=0,l=h>o?o:h,_=t[f],b=l;b<_.s_size;b++){if(n+l==u){a=-1;break}if(a=r.charCodeAt(n+l)-_.s[b])break;l++}if(0>a?(e=f,h=l):(s=f,o=l),1>=e-s){if(s>0||e==s||c)break;c=!0}}for(;;){var _=t[s];if(o>=_.s_size){if(this.cursor=n+_.s_size,!_.method)return _.result;var m=_.method();if(this.cursor=n+_.s_size,m)return _.result}if(s=_.substring_i,0>s)return 0}},find_among_b:function(t,i){for(var s=0,e=i,n=this.cursor,u=this.limit_backward,o=0,h=0,c=!1;;){for(var f=s+(e-s>>1),a=0,l=h>o?o:h,_=t[f],b=_.s_size-1-l;b>=0;b--){if(n-l==u){a=-1;break}if(a=r.charCodeAt(n-1-l)-_.s[b])break;l++}if(0>a?(e=f,h=l):(s=f,o=l),1>=e-s){if(s>0||e==s||c)break;c=!0}}for(;;){var _=t[s];if(o>=_.s_size){if(this.cursor=n-_.s_size,!_.method)return _.result;var m=_.method();if(this.cursor=n-_.s_size,m)return _.result}if(s=_.substring_i,0>s)return 0}},replace_s:function(t,i,s){var e=s.length-(i-t),n=r.substring(0,t),u=r.substring(i);return r=n+s+u,this.limit+=e,this.cursor>=i?this.cursor+=e:this.cursor>t&&(this.cursor=t),e},slice_check:function(){if(this.bra<0||this.bra>this.ket||this.ket>this.limit||this.limit>r.length)throw"faulty slice operation"},slice_from:function(r){this.slice_check(),this.replace_s(this.bra,this.ket,r)},slice_del:function(){this.slice_from("")},insert:function(r,t,i){var s=this.replace_s(r,t,i);r<=this.bra&&(this.bra+=s),r<=this.ket&&(this.ket+=s)},slice_to:function(){return this.slice_check(),r.substring(this.bra,this.ket)},eq_v_b:function(r){return this.eq_s_b(r.length,r)}}}}}});
|
Reference in New Issue