Merge pull request #1266 from glowing-bear/lorenz/underscore-cleanup

Revert version number increase & clean up underscore cleanup
This commit is contained in:
Lorenz Hübschle 2023-07-12 22:52:21 +02:00 committed by GitHub
commit 6cd59b76d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 24 additions and 40 deletions

2
.gitignore vendored
View File

@ -6,5 +6,3 @@ build/
# IntelliJ / WebStorm
.idea/
src-tauri/target

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "glowing-bear",
"version": "0.11.0",
"version": "0.10.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "glowing-bear",
"version": "0.11.0",
"version": "0.10.0",
"license": "GPLv3",
"dependencies": {
"angular": "^1.8.3",

View File

@ -1,7 +1,7 @@
{
"name": "glowing-bear",
"private": true,
"version": "0.11.0",
"version": "0.10.0",
"description": "A web client for Weechat",
"repository": "https://github.com/glowing-bear/glowing-bear",
"license": "GPLv3",

2
src-tauri/Cargo.lock generated
View File

@ -991,7 +991,7 @@ dependencies = [
[[package]]
name = "glowing-bear"
version = "0.11.0"
version = "0.10.0"
dependencies = [
"serde",
"serde_json",

View File

@ -1,6 +1,6 @@
[package]
name = "glowing-bear"
version = "0.11.0" #sync to ../package.json
version = "0.10.0" #sync to ../package.json
description = "A web client for WeeChat"
authors = ["glowing-bear-contributors"]
license = "GPL-3.0"

View File

@ -8,7 +8,7 @@
},
"package": {
"productName": "glowing-bear",
"version": "0.11.0"
"version": "0.10.0"
},
"tauri": {
"allowlist": {

View File

@ -432,7 +432,7 @@ chown -R <strong>username</strong>:<strong>username</strong> ~<strong>username</
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" ng-click="closeModal($event)" aria-hidden="true">&times;</button>
<span class="pull-right version">Glowing Bear version 0.11.0</span>
<span class="pull-right version">Glowing Bear version 0.10.0</span>
<h4 class="modal-title">Settings</h4>
<p>Settings will be stored in your browser.</p>
</div>

View File

@ -4,6 +4,7 @@ import * as Favico from "favico.js";
import { connectionFactory } from './connection';
import { sortBy } from './misc';
/* debounce helper so we dont have to use underscore.js */
const debounce = function (func, wait, immediate) {
@ -19,10 +20,6 @@ const debounce = function (func, wait, immediate) {
};
};
const sortBy = (key) => {
return (a, b) => (a[key] > b[key]) ? 1 : ((b[key] > a[key]) ? -1 : 0);
};
var weechat = angular.module('weechat', ['ngRoute', 'localStorage', 'weechatModels', 'bufferResume', 'plugins', 'IrcUtils', 'ngSanitize', 'ngWebsockets', 'ngTouch'], ['$compileProvider', function($compileProvider) {
// hacky way to be able to find out if we're in debug mode
weechat.compileProvider = $compileProvider;

View File

@ -104,7 +104,7 @@ weechat.directive('inputBar', function() {
var completion_suffix = models.wconfig['weechat.completion.nick_completer'];
var add_space = models.wconfig['weechat.completion.nick_add_space'];
var nickComp = IrcUtils.completeNick(input, caretPos, $scope.iterCandidate,
activeBuffer.getNicklistByTime(),
activeBuffer.getNicklistByTime().reverse(),
completion_suffix, add_space);
// remember iteration candidate

View File

@ -16,19 +16,6 @@ IrcUtils.service('IrcUtils', [function() {
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
};
/**
* Get a new version of a nick list
*
* @param nickList Original nick list
* @return list of nick names
*/
var _ciNickList = function(nickList) {
let newList = nickList.map((el) => el.name);
return newList;
};
/**
* Completes a single nick.
*
@ -118,7 +105,7 @@ IrcUtils.service('IrcUtils', [function() {
var addSpaceChar = (addSpace === undefined || addSpace === 'on') ? ' ' : '';
// new nick list to search in
var searchNickList = _ciNickList(nickList);
var searchNickList = nickList.map((el) => el.name);
// text before and after caret
var beforeCaret = text.substring(0, caretPos);

5
src/js/misc.js Normal file
View File

@ -0,0 +1,5 @@
'use strict';
export const sortBy = (key) => {
return (a, b) => (a[key] > b[key]) ? 1 : ((b[key] > a[key]) ? -1 : 0);
}

View File

@ -7,6 +7,7 @@
import * as weeChat from './weechat';
import { sortBy } from './misc';
var models = angular.module('weechatModels', []);
@ -219,9 +220,10 @@ models.service('models', ['$rootScope', '$filter', 'bufferResume', function($roo
}
for (let groupIdx in nicklist) {
let nicks = nicklist[groupIdx].nicks;
for (let nickIdx in nicks) {
if (nicks[nickIdx].name === nick) {
nicks[nickIdx].spokeAt = Date.now();
for (let curr_nick of nicks) {
if (curr_nick.name === nick) {
curr_nick.spokeAt = Date.now();
return;
}
}
}
@ -235,15 +237,10 @@ models.service('models', ['$rootScope', '$filter', 'bufferResume', function($roo
var getNicklistByTime = function() {
var newlist = [];
for (let groupIdx in nicklist) {
let nicks = nicklist[groupIdx].nicks;
for (let nickIdx in nicks) {
newlist.push(nicks[nickIdx]);
}
newlist = newlist.concat(nicklist[groupIdx].nicks);
}
newlist.sort(function(a, b) {
return a.spokeAt < b.spokeAt;
});
newlist.sort(sortBy('spokeAt'));
return newlist;
};

View File

@ -1,7 +1,7 @@
{
"name": "Glowing Bear",
"description": "WeeChat Web frontend",
"version": "0.11.0",
"version": "0.10.0",
"manifest_version": 2,
"icons": {
"32": "assets/img/favicon.png",

View File

@ -25,5 +25,5 @@
"desktop-notification":{}
},
"default_locale": "en",
"version": "0.11.0"
"version": "0.10.0"
}