Commit 07f6cc1a authored by Cerdic's avatar Cerdic

semantique : utiliser un button et pas un a et utiliser des classes pour ne...

semantique : utiliser un button et pas un a et utiliser des classes pour ne pas dependre des balises choisies
parent 21a6872a
jQuery.fn.checkOfflineStatus = function() {
return this.each(function() {
var me = jQuery(this);
var url = me.attr('href');
var url = me.attr('data-src');
url = parametre_url(url, 'var_mode','loaded');
console.log('check offline '+url);
caches.match(url).then(
......@@ -40,7 +40,7 @@ var offline = {
jQuery('.offline-download.activable')
.removeClass('activable')
.addClass('active')
.find('a').on('click', offline.downloadURLs)
.find('.btn-download').on('click', offline.downloadURLs)
.checkOfflineStatus()
;
}
......@@ -52,7 +52,7 @@ var offline = {
downloadURLs: function(event) {
event.preventDefault();
var me = jQuery(this);
var src = me.attr('href');
var src = me.attr('data-src');
offline.promptPersistent();
me.setOfflineDownloadingStatus(true);
caches.open(offlineConfig.cacheName).then(function(cache) {
......
<div class="offline-download[ (#ENV{status,unactive})]">
<a href="[(#EVAL{_DIR_RACINE}|url_absolue|concat{offline.api.urlsdownload.json}|parametre_url{objet,#ENV{objet}}|parametre_url{id_objet,#ENV{id_objet}})]"
class="btn-link">
<button data-src="[(#EVAL{_DIR_RACINE}|url_absolue|concat{offline.api.urlsdownload.json}|parametre_url{objet,#ENV{objet}}|parametre_url{id_objet,#ENV{id_objet}})]"
class="btn btn-link btn-download">
[(#CHEMIN{img/travel-32.png}|balise_img)]
<span class="label">[(#ENV{label_active,<:offline:offline_info_telecharger_lecture_offline_active:>}|attribut_html)]</span>
</a>
<span class="btn-link disabled">
</button>
<span class="btn btn-link btn-disabled">
[(#CHEMIN{img/travel-off-32.png}|balise_img)]
<span class="label">[(#ENV{label_unactive,<:offline:offline_info_telecharger_lecture_offline_unactive:>}|attribut_html)]</span>
</span>
<span class="progress"></span>
<span class="offline-progress"></span>
</div>
<style type="text/css">
.offline-download {float: right;margin: 10px;text-align: center;position: relative}
.offline-download .label {display: block;text-align: center;max-width: 150px;font-size: 12px}
.offline-download>a {display: none}
.offline-download>.downloading {display: none}
.offline-download>span {display: block}
.offline-download.active>a {display: block}
.offline-download.active>span {display: none}
.offline-download .label {display: block;text-align: center;max-width: 120px;font-size: 12px}
.offline-download .btn-download {display: none;}
.offline-download .downloading {display: none}
.offline-download .btn-disabled {display: block}
.offline-download.active .btn-download {display: block}
.offline-download.active .btn-disabled {display: none}
.offline-download.activable {opacity: 0.5;}
.offline-download.offline-ok:after {
content:'\02714';
......@@ -41,7 +41,7 @@
right: 0;
bottom: 0;
}
.offline-download.offline-downloading>.progress {
.offline-download.offline-downloading .offline-progress {
display: block;
position: absolute;
top:0;left: 0;width: 100%;height: 100%;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment