mirror of
https://github.com/Hopiu/ep_page_view.git
synced 2026-05-14 07:33:11 +00:00
Fix jQuery related issues
This commit is contained in:
parent
75d667a29e
commit
79471e95a4
2 changed files with 21 additions and 28 deletions
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "ep_page_view",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.1",
|
||||
"keywords": ["page view", "pv", "preview", "overview"],
|
||||
"description": "Add support to do 'page view', with a toggle on/off option in Settings",
|
||||
|
||||
|
|
@ -27,4 +27,4 @@
|
|||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,39 +1,32 @@
|
|||
var isMobile = require('ep_etherpad-lite/static/js/ace2_common').browser.mobile;
|
||||
var isMobile = $.browser.mobile;
|
||||
|
||||
if (!isMobile) {
|
||||
var postAceInit = function(hook, context){
|
||||
|
||||
/* Check on Init */
|
||||
if($('#options-pageview').attr('checked')) {
|
||||
enablePageView();
|
||||
} else {
|
||||
disablePageView();
|
||||
var pv = {
|
||||
enable: function() {
|
||||
$('#editorcontainer, iframe').addClass('page_view');
|
||||
},
|
||||
disable: function() {
|
||||
$('#editorcontainer, iframe').removeClass('page_view');
|
||||
}
|
||||
}
|
||||
|
||||
/* Check on Click */
|
||||
$('#options-pageview').on('click', function(){
|
||||
if($('#options-pageview').attr('checked')) {
|
||||
enablePageView();
|
||||
/* init */
|
||||
if($('#options-pageview').is(':checked')) {
|
||||
pv.enable();
|
||||
} else {
|
||||
pv.disable();
|
||||
}
|
||||
/* on click */
|
||||
$('#options-pageview').on('click', function() {
|
||||
if($('#options-pageview').is(':checked')) {
|
||||
pv.enable();
|
||||
} else {
|
||||
disablePageView();
|
||||
pv.disable();
|
||||
}
|
||||
});
|
||||
|
||||
function enablePageView(){
|
||||
$('#editorcontainer').addClass('page_view');
|
||||
$('iframe').addClass('page_view');
|
||||
|
||||
}
|
||||
|
||||
function disablePageView(){
|
||||
$('#editorcontainer').removeClass('page_view');
|
||||
$('iframe').removeClass('page_view');
|
||||
}
|
||||
};
|
||||
|
||||
exports.postAceInit = postAceInit;
|
||||
} else {
|
||||
$('input#options-pageview').hide();
|
||||
$('label[for=options-pageview]').hide();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue