mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 07:56:16 -04:00
Merge branch 'develop' of https://github.com/ether/etherpad-lite into hardcoded-i18n
This commit is contained in:
commit
4a20a26cbf
13 changed files with 307 additions and 116 deletions
|
@ -25,10 +25,6 @@ $(document).ready(function () {
|
|||
}
|
||||
|
||||
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,8 +32,8 @@ $(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;
|
||||
|
@ -47,13 +43,13 @@ $(document).ready(function () {
|
|||
$(".do-install").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());
|
||||
});
|
||||
|
||||
$(".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());
|
||||
});
|
||||
|
||||
$(".do-prev-page").unbind('click').click(function (e) {
|
||||
|
@ -77,32 +73,32 @@ $(document).ready(function () {
|
|||
updateHandlers();
|
||||
|
||||
socket.on('progress', function (data) {
|
||||
if (data.progress > 0 && $('#progress.dialog').data('progress') > data.progress) return;
|
||||
if (data.progress > 0 && $('#progress').data('progress') > data.progress) return;
|
||||
|
||||
$("#progress.dialog .close").hide();
|
||||
$("#progress.dialog").show();
|
||||
$("#progress").show();
|
||||
|
||||
$('#progress.dialog').data('progress', data.progress);
|
||||
$('#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) {
|
||||
$("#progress").hide();
|
||||
|
||||
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");
|
||||
}
|
||||
$("#progress.dialog").hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -114,7 +110,11 @@ $(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();
|
||||
|
@ -124,9 +124,12 @@ $(document).ready(function () {
|
|||
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);
|
||||
|
||||
|
@ -144,7 +147,11 @@ $(document).ready(function () {
|
|||
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);
|
||||
}
|
||||
|
|
|
@ -361,7 +361,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)
|
||||
|
|
|
@ -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