ep_button_link
Advanced tools
Comparing version 0.1.6 to 0.1.8
85
index.js
@@ -1,50 +0,49 @@ | ||
var settings = require('ep_etherpad-lite/node/utils/Settings'); | ||
const settings = require('ep_etherpad-lite/node/utils/Settings'); | ||
exports.clientVars = function(hook, context, callback){ | ||
var ep_button_link = {}; | ||
exports.clientVars = function (hook, context, callback) { | ||
let ep_button_link = {}; | ||
try { | ||
if (settings.ep_button_link){ | ||
if(!settings.ep_button_link.link){ | ||
console.warn("No link set for ep_button_link, add ep_button_link.link to settings.json"); | ||
ep_button_link.link = "https://github.com/JohnMcLear/ep_button_link"; | ||
}else{ | ||
ep_button_link.link = settings.ep_button_link.link; | ||
} | ||
if(!settings.ep_button_link.text){ | ||
ep_button_link.text = "NO TEXT SET"; | ||
console.warn("No text set for ep_button_link, add ep_button_link.text to settings.json"); | ||
}else{ | ||
ep_button_link.text = settings.ep_button_link.text; | ||
} | ||
if(!settings.ep_button_link.before){ | ||
ep_button_link.before = "[data-key='showTimeSlider']"; | ||
console.info("No before set for ep_button_link, this may be intentional, add ep_button_link.before to settings.json"); | ||
}else{ | ||
ep_button_link.before = settings.ep_button_link.before; | ||
} | ||
if(!settings.ep_button_link.classes){ | ||
ep_button_link.classes = "grouped-left"; | ||
console.info("No classes set for ep_button_link, this may be intentional, add ep_button_link.classes to settings.json"); | ||
}else{ | ||
ep_button_link.classes = settings.ep_button_link.classes; | ||
} | ||
if(!settings.ep_button_link.after){ | ||
console.info("No after set for ep_button_link, this may be intentional, add ep_button_link.classes to settings.json"); | ||
}else{ | ||
ep_button_link.after = settings.ep_button_link.after; | ||
} | ||
}else{ | ||
if (settings.ep_button_link) { | ||
if (!settings.ep_button_link.link) { | ||
console.warn('No link set for ep_button_link, add ep_button_link.link to settings.json'); | ||
ep_button_link.link = 'https://github.com/JohnMcLear/ep_button_link'; | ||
} else { | ||
ep_button_link.link = settings.ep_button_link.link; | ||
} | ||
if (!settings.ep_button_link.text) { | ||
ep_button_link.text = 'NO TEXT SET'; | ||
console.warn('No text set for ep_button_link, add ep_button_link.text to settings.json'); | ||
} else { | ||
ep_button_link.text = settings.ep_button_link.text; | ||
} | ||
if (!settings.ep_button_link.before) { | ||
ep_button_link.before = "[data-key='showTimeSlider']"; | ||
console.info('No before set for ep_button_link, this may be intentional, add ep_button_link.before to settings.json'); | ||
} else { | ||
ep_button_link.before = settings.ep_button_link.before; | ||
} | ||
if (!settings.ep_button_link.classes) { | ||
ep_button_link.classes = 'grouped-left'; | ||
console.info('No classes set for ep_button_link, this may be intentional, add ep_button_link.classes to settings.json'); | ||
} else { | ||
ep_button_link.classes = settings.ep_button_link.classes; | ||
} | ||
if (!settings.ep_button_link.after) { | ||
console.info('No after set for ep_button_link, this may be intentional, add ep_button_link.classes to settings.json'); | ||
} else { | ||
ep_button_link.after = settings.ep_button_link.after; | ||
} | ||
} else { | ||
console.warn('Set ep_button_link settings in settings.json, example is: "ep_button_link":{ "link" : "https://github.com/JohnMcLear/ep_button", "text": "TEST"}'); | ||
ep_button_link = {}; | ||
ep_button_link.link = "https://github.com/JohnMcLear/ep_button_link"; | ||
ep_button_link.text = "NO TEXT SET"; | ||
ep_button_link.before = ".buttonicon-history"; | ||
ep_button_link.classes = "grouped-right"; | ||
console.warn("No link set for ep_button_link, add ep_button_link.link to settings.json"); | ||
console.warn("No text set for ep_button_link, add ep_button_link.text to settings.json"); | ||
ep_button_link.link = 'https://github.com/JohnMcLear/ep_button_link'; | ||
ep_button_link.text = 'NO TEXT SET'; | ||
ep_button_link.before = '.buttonicon-history'; | ||
ep_button_link.classes = 'grouped-right'; | ||
console.warn('No link set for ep_button_link, add ep_button_link.link to settings.json'); | ||
console.warn('No text set for ep_button_link, add ep_button_link.text to settings.json'); | ||
} | ||
} catch (e){ | ||
} catch (e) { | ||
} | ||
return callback({ep_button_link: ep_button_link}); | ||
return callback({ep_button_link}); | ||
}; |
{ | ||
"name": "ep_button_link", | ||
"description": "Adds a button to the toolbar that links out to a new window", | ||
"version": "0.1.6", | ||
"version": "0.1.8", | ||
"author": "johnyma22 (John McLear) <john@mclear.co.uk>", | ||
@@ -17,3 +17,19 @@ "dependencies": {}, | ||
"url": "http://etherpad.org/" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^7.14.0", | ||
"eslint-config-etherpad": "^1.0.8", | ||
"eslint-plugin-mocha": "^8.0.0", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-prefer-arrow": "^1.2.2", | ||
"eslint-plugin-promise": "^4.2.1" | ||
}, | ||
"eslintConfig": { | ||
"root": true, | ||
"extends": "etherpad/plugin" | ||
}, | ||
"scripts": { | ||
"lint": "eslint .", | ||
"lint:fix": "eslint --fix ." | ||
} | ||
} |
@@ -1,22 +0,21 @@ | ||
exports.postAceInit = function(hook_name, args) { | ||
exports.postAceInit = function (hook_name, args) { | ||
// if the button already exists, don't write it again.. | ||
if($('#ep_button_link_span').length !== 0) return; | ||
if ($('#ep_button_link_span').length !== 0) return; | ||
var link = clientVars.ep_button_link.link; | ||
var text = clientVars.ep_button_link.text; | ||
var before = clientVars.ep_button_link.before; | ||
var after = clientVars.ep_button_link.after; | ||
var classes = clientVars.ep_button_link.classes; | ||
const link = clientVars.ep_button_link.link; | ||
const text = clientVars.ep_button_link.text; | ||
const before = clientVars.ep_button_link.before; | ||
const after = clientVars.ep_button_link.after; | ||
const classes = clientVars.ep_button_link.classes; | ||
var button = "<li><a class='"+classes+"' target='_blank' href='"+link+"'><span id='ep_button_link_span' class='buttonicon'>" + text + "</span></a></li>"; | ||
var $editBar = $("#editbar"); | ||
const button = `<li><a class='${classes}' target='_blank' href='${link}'><span id='ep_button_link_span' class='buttonicon'>${text}</span></a></li>`; | ||
const $editBar = $('#editbar'); | ||
if(after){ | ||
if (after) { | ||
$editBar.contents().find(after).after(button); | ||
}else{ | ||
} else { | ||
$editBar.contents().find(before).before(button); | ||
} | ||
$('#ep_button_link_span').css({"background-image":"none", "width": "auto", "color":"#666", "font-size":"16px", "font-weight":"800" }); | ||
} | ||
$('#ep_button_link_span').css({'background-image': 'none', 'width': 'auto', 'color': '#666', 'font-size': '16px', 'font-weight': '800'}); | ||
}; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9022
8
6