2013-08-29 10:29:56 +00:00
|
|
|
(function () {
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var website = openerp.website;
|
2014-06-27 09:03:34 +00:00
|
|
|
website.add_template_file('/website/static/src/xml/website.xml');
|
2013-08-29 10:29:56 +00:00
|
|
|
|
|
|
|
website.MobilePreview = openerp.Widget.extend({
|
|
|
|
template: 'website.mobile_preview',
|
|
|
|
events: {
|
2013-08-30 13:19:52 +00:00
|
|
|
'hidden.bs.modal': 'destroy'
|
2013-08-29 10:29:56 +00:00
|
|
|
},
|
2014-06-27 09:03:34 +00:00
|
|
|
start: function() {
|
2014-02-24 14:38:28 +00:00
|
|
|
if (!window.location.origin) { // fix for ie9
|
2014-03-14 16:23:46 +00:00
|
|
|
window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port: '');
|
2014-02-21 07:15:12 +00:00
|
|
|
}
|
2014-06-18 09:26:55 +00:00
|
|
|
document.getElementById("mobile-viewport").src = window.location.origin + window.location.pathname + window.location.search + "#mobile-preview";
|
2013-08-29 10:29:56 +00:00
|
|
|
this.$el.modal();
|
|
|
|
},
|
2014-06-27 09:03:34 +00:00
|
|
|
destroy: function() {
|
2013-11-19 16:02:15 +00:00
|
|
|
$('.modal-backdrop').remove();
|
|
|
|
this._super();
|
|
|
|
},
|
2013-08-29 10:29:56 +00:00
|
|
|
});
|
2014-06-27 09:03:34 +00:00
|
|
|
|
|
|
|
website.ready().done(function() {
|
|
|
|
$(document.body).on('click', 'a[data-action=show-mobile-preview]', function() {
|
|
|
|
new website.MobilePreview().appendTo($(document.body));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2013-08-29 10:29:56 +00:00
|
|
|
})();
|