mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-06-18 04:04:50 -04:00
resolve merge conflict
This commit is contained in:
commit
3fac18f88a
22 changed files with 517 additions and 137 deletions
|
@ -22,13 +22,10 @@ $(document).ready(function () {
|
|||
|
||||
var search = function () {
|
||||
socket.emit("search", $('.search-results').data('query'));
|
||||
tasks++;
|
||||
}
|
||||
|
||||
function updateHandlers() {
|
||||
$("#progress.dialog .close").unbind('click').click(function () {
|
||||
$("#progress.dialog").hide();
|
||||
});
|
||||
|
||||
$("form").submit(function(){
|
||||
var query = $('.search-results').data('query');
|
||||
query.pattern = $("#search-query").val();
|
||||
|
@ -36,24 +33,26 @@ $(document).ready(function () {
|
|||
search();
|
||||
return false;
|
||||
});
|
||||
|
||||
$("#do-search").unbind('click').click(function () {
|
||||
|
||||
$("#search-query").unbind('keyup').keyup(function () {
|
||||
var query = $('.search-results').data('query');
|
||||
query.pattern = $("#search-query").val();
|
||||
query.offset = 0;
|
||||
search();
|
||||
});
|
||||
|
||||
$(".do-install").unbind('click').click(function (e) {
|
||||
$(".do-install, .do-update").unbind('click').click(function (e) {
|
||||
var row = $(e.target).closest("tr");
|
||||
doUpdate = true;
|
||||
socket.emit("install", row.find(".name").html());
|
||||
socket.emit("install", row.find(".name").text());
|
||||
tasks++;
|
||||
});
|
||||
|
||||
$(".do-uninstall").unbind('click').click(function (e) {
|
||||
var row = $(e.target).closest("tr");
|
||||
doUpdate = true;
|
||||
socket.emit("uninstall", row.find(".name").html());
|
||||
socket.emit("uninstall", row.find(".name").text());
|
||||
tasks++;
|
||||
});
|
||||
|
||||
$(".do-prev-page").unbind('click').click(function (e) {
|
||||
|
@ -76,33 +75,37 @@ $(document).ready(function () {
|
|||
|
||||
updateHandlers();
|
||||
|
||||
var tasks = 0;
|
||||
socket.on('progress', function (data) {
|
||||
if (data.progress > 0 && $('#progress.dialog').data('progress') > data.progress) return;
|
||||
|
||||
$("#progress.dialog .close").hide();
|
||||
$("#progress.dialog").show();
|
||||
|
||||
$('#progress.dialog').data('progress', data.progress);
|
||||
$("#progress").show();
|
||||
$('#progress').data('progress', data.progress);
|
||||
|
||||
var message = "Unknown status";
|
||||
if (data.message) {
|
||||
message = "<span class='status'>" + data.message.toString() + "</span>";
|
||||
message = data.message.toString();
|
||||
}
|
||||
if (data.error) {
|
||||
message = "<span class='error'>" + data.error.toString() + "<span>";
|
||||
data.progress = 1;
|
||||
}
|
||||
$("#progress.dialog .message").html(message);
|
||||
$("#progress.dialog .history").append("<div>" + message + "</div>");
|
||||
|
||||
$("#progress .message").html(message);
|
||||
|
||||
if (data.progress >= 1) {
|
||||
tasks--;
|
||||
if (tasks <= 0) {
|
||||
// Hide the activity indicator once all tasks are done
|
||||
$("#progress").hide();
|
||||
tasks = 0;
|
||||
}
|
||||
|
||||
if (data.error) {
|
||||
$("#progress.dialog .close").show();
|
||||
} else {
|
||||
alert('An error occurred: '+data.error+' -- the server log might know more...');
|
||||
}else {
|
||||
if (doUpdate) {
|
||||
doUpdate = false;
|
||||
socket.emit("load");
|
||||
tasks++;
|
||||
}
|
||||
$("#progress.dialog").hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -114,21 +117,26 @@ $(document).ready(function () {
|
|||
widget.data('total', data.total);
|
||||
|
||||
widget.find('.offset').html(data.query.offset);
|
||||
widget.find('.limit').html(data.query.offset + data.query.limit);
|
||||
if (data.query.offset + data.query.limit > data.total){
|
||||
widget.find('.limit').html(data.total);
|
||||
}else{
|
||||
widget.find('.limit').html(data.query.offset + data.query.limit);
|
||||
}
|
||||
widget.find('.total').html(data.total);
|
||||
|
||||
widget.find(".results *").remove();
|
||||
for (plugin_name in data.results) {
|
||||
var plugin = data.results[plugin_name];
|
||||
var row = widget.find(".template tr").clone();
|
||||
var version = '0.0.0';
|
||||
// hack to access "versions" property of the npm package object
|
||||
for (version in data.results[plugin_name].versions) break;
|
||||
|
||||
|
||||
for (attr in plugin) {
|
||||
row.find("." + attr).html(plugin[attr]);
|
||||
if(attr == "name"){ // Hack to rewrite URLS into name
|
||||
row.find(".name").html("<a target='_blank' href='https://npmjs.org/package/"+plugin['name']+"'>"+plugin[attr]+"</a>");
|
||||
}else{
|
||||
row.find("." + attr).html(plugin[attr]);
|
||||
}
|
||||
}
|
||||
row.find(".version").html(version);
|
||||
row.find(".version").html( data.results[plugin_name]['dist-tags'].latest );
|
||||
|
||||
widget.find(".results").append(row);
|
||||
}
|
||||
|
@ -138,20 +146,42 @@ $(document).ready(function () {
|
|||
|
||||
socket.on('installed-results', function (data) {
|
||||
$("#installed-plugins *").remove();
|
||||
|
||||
for (plugin_name in data.results) {
|
||||
if (plugin_name == "ep_etherpad-lite") continue; // Hack...
|
||||
var plugin = data.results[plugin_name];
|
||||
var row = $("#installed-plugin-template").clone();
|
||||
|
||||
for (attr in plugin.package) {
|
||||
row.find("." + attr).html(plugin.package[attr]);
|
||||
if(attr == "name"){ // Hack to rewrite URLS into name
|
||||
row.find(".name").html("<a target='_blank' href='https://npmjs.org/package/"+plugin.package['name']+"'>"+plugin.package[attr]+"</a>");
|
||||
}else{
|
||||
row.find("." + attr).html(plugin.package[attr]);
|
||||
}
|
||||
}
|
||||
$("#installed-plugins").append(row);
|
||||
}
|
||||
updateHandlers();
|
||||
|
||||
socket.emit('checkUpdates');
|
||||
tasks++;
|
||||
});
|
||||
|
||||
socket.on('updatable', function(data) {
|
||||
$('#installed-plugins>tr').each(function(i,tr) {
|
||||
var pluginName = $(tr).find('.name').text()
|
||||
|
||||
if (data.updatable.indexOf(pluginName) >= 0) {
|
||||
var actions = $(tr).find('.actions')
|
||||
actions.append('<input class="do-update" type="button" value="Update" />')
|
||||
actions.css('width', 200)
|
||||
}
|
||||
})
|
||||
updateHandlers();
|
||||
})
|
||||
|
||||
socket.emit("load");
|
||||
tasks++;
|
||||
|
||||
search();
|
||||
|
||||
});
|
||||
|
|
|
@ -193,7 +193,12 @@ function loadBroadcastSliderJS(fireWhenAllScriptsAreLoaded)
|
|||
});
|
||||
if (numAnonymous > 0)
|
||||
{
|
||||
var anonymousAuthorString = numAnonymous + " unnamed author" + (numAnonymous > 1 ? "s" : "")
|
||||
var anonymousAuthorString;
|
||||
if(numAnonymous == 1)
|
||||
anonymousAuthorString = html10n.get("timeslider.unnamedauthor", { num: numAnonymous });
|
||||
else
|
||||
anonymousAuthorString = html10n.get("timeslider.unnamedauthors", { num: numAnonymous });
|
||||
|
||||
if (numNamed !== 0){
|
||||
authorsList.append(' + ' + anonymousAuthorString);
|
||||
} else {
|
||||
|
@ -361,7 +366,11 @@ function loadBroadcastSliderJS(fireWhenAllScriptsAreLoaded)
|
|||
$(self).css('left', newloc);
|
||||
// if(getSliderPosition() != Math.floor(newloc * sliderLength / ($("#ui-slider-bar").width()-2)))
|
||||
setSliderPosition(Math.floor(newloc * sliderLength / ($("#ui-slider-bar").width() - 2)))
|
||||
self.currentLoc = parseInt($(self).css('left'));
|
||||
if(parseInt($(self).css('left')) < 2){
|
||||
$(self).css('left', '2px');
|
||||
}else{
|
||||
self.currentLoc = parseInt($(self).css('left'));
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
* IN THE SOFTWARE.
|
||||
*/
|
||||
window.html10n = (function(window, document, undefined) {
|
||||
|
||||
// fix console
|
||||
var console = window.console
|
||||
function interceptConsole(method){
|
||||
if (!console) return function() {}
|
||||
|
@ -44,6 +46,39 @@ window.html10n = (function(window, document, undefined) {
|
|||
, consoleError = interceptConsole('warn')
|
||||
|
||||
|
||||
// fix Array.prototype.instanceOf in, guess what, IE! <3
|
||||
if (!Array.prototype.indexOf) {
|
||||
Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) {
|
||||
"use strict";
|
||||
if (this == null) {
|
||||
throw new TypeError();
|
||||
}
|
||||
var t = Object(this);
|
||||
var len = t.length >>> 0;
|
||||
if (len === 0) {
|
||||
return -1;
|
||||
}
|
||||
var n = 0;
|
||||
if (arguments.length > 1) {
|
||||
n = Number(arguments[1]);
|
||||
if (n != n) { // shortcut for verifying if it's NaN
|
||||
n = 0;
|
||||
} else if (n != 0 && n != Infinity && n != -Infinity) {
|
||||
n = (n > 0 || -1) * Math.floor(Math.abs(n));
|
||||
}
|
||||
}
|
||||
if (n >= len) {
|
||||
return -1;
|
||||
}
|
||||
var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0);
|
||||
for (; k < len; k++) {
|
||||
if (k in t && t[k] === searchElement) {
|
||||
return k;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* MicroEvent - to make any js object an event emitter (server or browser)
|
||||
|
|
|
@ -78,6 +78,16 @@ var padeditor = (function()
|
|||
|
||||
html10n.bind('localized', function() {
|
||||
$("#languagemenu").val(html10n.getLanguage());
|
||||
// translate the value of 'unnamed' and 'Enter your name' textboxes in the userlist
|
||||
// this does not interfere with html10n's normal value-setting because html10n just ingores <input>s
|
||||
// also, a value which has been set by the user will be not overwritten since a user-edited <input>
|
||||
// does *not* have the editempty-class
|
||||
$('input[data-l10n-id]').each(function(key, input)
|
||||
{
|
||||
input = $(input);
|
||||
if(input.hasClass("editempty"))
|
||||
input.val(html10n.get(input.attr("data-l10n-id")));
|
||||
});
|
||||
})
|
||||
$("#languagemenu").val(html10n.getLanguage());
|
||||
$("#languagemenu").change(function() {
|
||||
|
|
|
@ -212,10 +212,8 @@ var padimpexp = (function()
|
|||
|
||||
//get /p/padname
|
||||
var pad_root_path = new RegExp(/.*\/p\/[^\/]+/).exec(document.location.pathname);
|
||||
//get http://example.com/p/padname
|
||||
var pad_root_url = document.location.href.replace(document.location.pathname, pad_root_path);
|
||||
//strip out params IE ?noColor=true
|
||||
pad_root_url = pad_root_url.substring(0, pad_root_url.indexOf('?'));
|
||||
//get http://example.com/p/padname without Params
|
||||
var pad_root_url = document.location.protocol + '//' + document.location.host + document.location.pathname;
|
||||
|
||||
//i10l buttom import
|
||||
$('#importsubmitinput').val(html10n.get("pad.impexp.importbutton"));
|
||||
|
|
|
@ -118,7 +118,7 @@ var paduserlist = (function()
|
|||
}
|
||||
else
|
||||
{
|
||||
nameHtml = '<input type="text" class="editempty newinput" value="'+_('pad.userlist.unnamed')+'" ' + (isNameEditable(data) ? '' : 'disabled="disabled" ') + '/>';
|
||||
nameHtml = '<input data-l10n-id="pad.userlist.unnamed" type="text" class="editempty newinput" value="'+_('pad.userlist.unnamed')+'" ' + (isNameEditable(data) ? '' : 'disabled="disabled" ') + '/>';
|
||||
}
|
||||
|
||||
return ['<td style="height:', height, 'px" class="usertdswatch"><div class="swatch" style="background:' + data.color + '"> </div></td>', '<td style="height:', height, 'px" class="usertdname">', nameHtml, '</td>', '<td style="height:', height, 'px" class="activity">', padutils.escapeHtml(data.activity), '</td>'].join('');
|
||||
|
@ -710,8 +710,7 @@ var paduserlist = (function()
|
|||
{
|
||||
if (myUserInfo.name)
|
||||
{
|
||||
$("#myusernameedit").removeClass("editempty").val(
|
||||
myUserInfo.name);
|
||||
$("#myusernameedit").removeClass("editempty").val(myUserInfo.name);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -15,7 +15,10 @@ var withNpm = function (npmfn, final, cb) {
|
|||
cb({progress: 0.5, message:message.msg + ": " + message.pref});
|
||||
});
|
||||
npmfn(function (er, data) {
|
||||
if (er) return cb({progress:1, error:er.code + ": " + er.path});
|
||||
if (er) {
|
||||
console.error(er);
|
||||
return cb({progress:1, error: er.message});
|
||||
}
|
||||
if (!data) data = {};
|
||||
data.progress = 1;
|
||||
data.message = "Done.";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue