mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-19 14:13:34 +01:00
Create a customizable timeslider toolbar
This commit is contained in:
parent
867e40533a
commit
6054cda473
9 changed files with 50 additions and 31 deletions
|
@ -115,6 +115,9 @@
|
||||||
["importexport", "timeslider", "savedrevision"],
|
["importexport", "timeslider", "savedrevision"],
|
||||||
["settings", "embed"],
|
["settings", "embed"],
|
||||||
["showusers"]
|
["showusers"]
|
||||||
|
],
|
||||||
|
"timeslider": [
|
||||||
|
["timeslider_export", "timeslider_returnToPad"]
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -46,7 +46,14 @@ exports.expressCreateServer = function (hook_name, args, cb) {
|
||||||
//serve timeslider.html under /p/$padname/timeslider
|
//serve timeslider.html under /p/$padname/timeslider
|
||||||
args.app.get('/p/:pad/timeslider', function(req, res, next)
|
args.app.get('/p/:pad/timeslider', function(req, res, next)
|
||||||
{
|
{
|
||||||
res.send(eejs.require("ep_etherpad-lite/templates/timeslider.html", {req: req}));
|
hooks.callAll("padInitToolbar", {
|
||||||
|
toolbar: toolbar
|
||||||
|
});
|
||||||
|
|
||||||
|
res.send(eejs.require("ep_etherpad-lite/templates/timeslider.html", {
|
||||||
|
req: req,
|
||||||
|
toolbar: toolbar
|
||||||
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
//serve favicon.ico from all path levels except as a pad name
|
//serve favicon.ico from all path levels except as a pad name
|
||||||
|
|
|
@ -93,6 +93,9 @@ exports.toolbar = {
|
||||||
["importexport", "timeslider", "savedrevision"],
|
["importexport", "timeslider", "savedrevision"],
|
||||||
["settings", "embed"],
|
["settings", "embed"],
|
||||||
["showusers"]
|
["showusers"]
|
||||||
|
],
|
||||||
|
timeslider: [
|
||||||
|
["timeslider_export", "timeslider_returnToPad"]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ defaultButtonAttributes = function (name, overrides) {
|
||||||
return {
|
return {
|
||||||
command: name,
|
command: name,
|
||||||
localizationId: "pad.toolbar." + name + ".title",
|
localizationId: "pad.toolbar." + name + ".title",
|
||||||
class: "buttonicon-" + name
|
class: "buttonicon buttonicon-" + name
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -99,8 +99,8 @@ _.extend(Button.prototype, {
|
||||||
"data-key": this.attributes.command,
|
"data-key": this.attributes.command,
|
||||||
};
|
};
|
||||||
return tag("li", liAttributes,
|
return tag("li", liAttributes,
|
||||||
tag("a", { "class": this.grouping, "data-l10n-id": this.attributes.localizationId },
|
tag("a", { "class": this.grouping },
|
||||||
tag("span", { "class": "buttonicon " + this.attributes.class })
|
tag("span", { "class": " "+ this.attributes.class, "data-l10n-id": this.attributes.localizationId })
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -162,20 +162,20 @@ module.exports = {
|
||||||
orderedlist: {
|
orderedlist: {
|
||||||
command: "insertorderedlist",
|
command: "insertorderedlist",
|
||||||
localizationId: "pad.toolbar.ol.title",
|
localizationId: "pad.toolbar.ol.title",
|
||||||
class: "buttonicon-insertorderedlist"
|
class: "buttonicon buttonicon-insertorderedlist"
|
||||||
},
|
},
|
||||||
|
|
||||||
unorderedlist: {
|
unorderedlist: {
|
||||||
command: "insertunorderedlist",
|
command: "insertunorderedlist",
|
||||||
localizationId: "pad.toolbar.ul.title",
|
localizationId: "pad.toolbar.ul.title",
|
||||||
class: "buttonicon-insertunorderedlist"
|
class: "buttonicon buttonicon-insertunorderedlist"
|
||||||
},
|
},
|
||||||
|
|
||||||
indent: defaultButtonAttributes("indent"),
|
indent: defaultButtonAttributes("indent"),
|
||||||
outdent: {
|
outdent: {
|
||||||
command: "outdent",
|
command: "outdent",
|
||||||
localizationId: "pad.toolbar.unindent.title",
|
localizationId: "pad.toolbar.unindent.title",
|
||||||
class: "buttonicon-outdent"
|
class: "buttonicon buttonicon-outdent"
|
||||||
},
|
},
|
||||||
|
|
||||||
undo: defaultButtonAttributes("undo"),
|
undo: defaultButtonAttributes("undo"),
|
||||||
|
@ -184,25 +184,37 @@ module.exports = {
|
||||||
clearauthorship: {
|
clearauthorship: {
|
||||||
command: "clearauthorship",
|
command: "clearauthorship",
|
||||||
localizationId: "pad.toolbar.clearAuthorship.title",
|
localizationId: "pad.toolbar.clearAuthorship.title",
|
||||||
class: "buttonicon-clearauthorship"
|
class: "buttonicon buttonicon-clearauthorship"
|
||||||
},
|
},
|
||||||
|
|
||||||
importexport: {
|
importexport: {
|
||||||
command: "import_export",
|
command: "import_export",
|
||||||
localizationId: "pad.toolbar.import_export.title",
|
localizationId: "pad.toolbar.import_export.title",
|
||||||
class: "buttonicon-import_export"
|
class: "buttonicon buttonicon-import_export"
|
||||||
},
|
},
|
||||||
|
|
||||||
timeslider: {
|
timeslider: {
|
||||||
command: "showTimeSlider",
|
command: "showTimeSlider",
|
||||||
localizationId: "pad.toolbar.timeslider.title",
|
localizationId: "pad.toolbar.timeslider.title",
|
||||||
class: "buttonicon-history"
|
class: "buttonicon buttonicon-history"
|
||||||
},
|
},
|
||||||
|
|
||||||
savedrevision: defaultButtonAttributes("savedRevision"),
|
savedrevision: defaultButtonAttributes("savedRevision"),
|
||||||
settings: defaultButtonAttributes("settings"),
|
settings: defaultButtonAttributes("settings"),
|
||||||
embed: defaultButtonAttributes("embed"),
|
embed: defaultButtonAttributes("embed"),
|
||||||
showusers: defaultButtonAttributes("showusers")
|
showusers: defaultButtonAttributes("showusers"),
|
||||||
|
|
||||||
|
timeslider_export: {
|
||||||
|
command: "import_export",
|
||||||
|
localizationId: "timeslider.toolbar.exportlink.title",
|
||||||
|
class: "buttonicon buttonicon-import_export"
|
||||||
|
},
|
||||||
|
|
||||||
|
timeslider_returnToPad: {
|
||||||
|
command: "timeslider_returnToPad",
|
||||||
|
localizationId: "timeslider.toolbar.returnbutton",
|
||||||
|
class: "buttontext"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
registerButton: function (buttonName, buttonInfo) {
|
registerButton: function (buttonName, buttonInfo) {
|
||||||
|
|
|
@ -126,6 +126,10 @@ a img {
|
||||||
position: relative;
|
position: relative;
|
||||||
top: 1px;
|
top: 1px;
|
||||||
}
|
}
|
||||||
|
.toolbar ul li a .buttontext {
|
||||||
|
color: #222;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
.toolbar ul li a.grouped-left {
|
.toolbar ul li a.grouped-left {
|
||||||
border-radius: 3px 0 0 3px;
|
border-radius: 3px 0 0 3px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,13 +157,6 @@
|
||||||
#editbarright {
|
#editbarright {
|
||||||
float: right
|
float: right
|
||||||
}
|
}
|
||||||
#returnbutton {
|
|
||||||
color: #222;
|
|
||||||
font-size: 16px;
|
|
||||||
line-height: 29px;
|
|
||||||
margin-top: 0;
|
|
||||||
padding-right: 6px;
|
|
||||||
}
|
|
||||||
#settings,
|
#settings,
|
||||||
#importexport,
|
#importexport,
|
||||||
#embed,
|
#embed,
|
||||||
|
|
|
@ -331,6 +331,14 @@ var padeditbar = (function()
|
||||||
ace.ace_setAttributeOnSelection('author', '');
|
ace.ace_setAttributeOnSelection('author', '');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
toolbar.registerCommand('timeslider_returnToPad', function(cmd) {
|
||||||
|
if( document.referrer.length > 0 && document.referrer.substring(document.referrer.lastIndexOf("/")-1, document.referrer.lastIndexOf("/")) === "p") {
|
||||||
|
document.location = document.referrer;
|
||||||
|
} else {
|
||||||
|
document.location = document.location.href.substring(0,document.location.href.lastIndexOf("/"));
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
|
|
|
@ -95,12 +95,6 @@ function init() {
|
||||||
//get all the export links
|
//get all the export links
|
||||||
export_links = $('#export > .exportlink')
|
export_links = $('#export > .exportlink')
|
||||||
|
|
||||||
if(document.referrer.length > 0 && document.referrer.substring(document.referrer.lastIndexOf("/")-1,document.referrer.lastIndexOf("/")) === "p") {
|
|
||||||
$("#returnbutton").attr("href", document.referrer);
|
|
||||||
} else {
|
|
||||||
$("#returnbutton").attr("href", document.location.href.substring(0,document.location.href.lastIndexOf("/")));
|
|
||||||
}
|
|
||||||
|
|
||||||
$('button#forcereconnect').click(function()
|
$('button#forcereconnect').click(function()
|
||||||
{
|
{
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
|
|
|
@ -80,14 +80,9 @@
|
||||||
<div class="editbarright toolbar" id="editbar">
|
<div class="editbarright toolbar" id="editbar">
|
||||||
<% e.begin_block("timesliderEditbarRight"); %>
|
<% e.begin_block("timesliderEditbarRight"); %>
|
||||||
<ul>
|
<ul>
|
||||||
<li onClick="window.padeditbar.triggerCommand('import_export');return false;">
|
<%- toolbar.menu(settings.toolbar.timeslider) %>
|
||||||
<a id="exportlink" data-l10n-id="timeslider.toolbar.exportlink.title">
|
|
||||||
<div class="buttonicon buttonicon-import_export"></div>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
<a id="returnbutton" data-l10n-id="timeslider.toolbar.returnbutton"></a>
|
<% e.end_block(); %>
|
||||||
<% e.end_block(); %>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
|
Loading…
Reference in a new issue