This commit is contained in:
Mr. Stallion 2020-06-20 13:43:34 -05:00
parent 0fea2479a9
commit 9a77c0a856
11 changed files with 164 additions and 100 deletions

5
.run/Debug.run.xml Normal file
View File

@ -0,0 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Debug" type="ChromiumRemoteDebugType" factoryName="Chromium Remote" port="9229">
<method v="2" />
</configuration>
</component>

View File

@ -27,8 +27,11 @@ export function analyzeUrlTag(parser: BBCodeParser, param: string, content: stri
if(param.length > 0) {
url = param.trim();
if(content.length === 0) textContent = param;
} else if(content.length > 0) url = content;
else {
} else if(content.length > 0) {
const m = content.match(/^\[url=?](.+)\[\/url]$/i);
url = m ? m[1] : content;
} else {
parser.warning('url tag contains no url.');
textContent = '';
success = false;

View File

@ -128,6 +128,10 @@ export class BBCodeParser {
currentTag = this._currentTag = {tag: self.tag, line: this._line, column: this._column};
}
let tagStart = -1, paramStart = -1, mark = start;
// @ts-ignore
let depth = 0;
for(let i = start; i < input.length; ++i) {
const c = input[i];
++this._column;
@ -136,64 +140,83 @@ export class BBCodeParser {
this._column = 1;
}
if(c === '[') {
tagStart = i;
paramStart = -1;
} else if(c === '=' && paramStart === -1)
paramStart = i;
else if(c === ']') {
const paramIndex = paramStart === -1 ? i : paramStart;
let tagKey = input.substring(tagStart + 1, paramIndex).trim().toLowerCase();
if(tagKey.length === 0) {
tagStart = -1;
continue;
depth++;
if (depth === 1) {
tagStart = i;
paramStart = -1;
} else {
console.log('Hit depth tagOpen', depth);
}
const param = paramStart > tagStart ? input.substring(paramStart + 1, i).trim() : '';
const close = tagKey[0] === '/';
if(close) tagKey = tagKey.substr(1).trim();
if(this._tags[tagKey] === undefined) {
tagStart = -1;
continue;
} else if(c === '=' && paramStart === -1) {
if (depth <= 1) {
paramStart = i;
} else {
console.log('Hit depth paramStart', depth);
}
if(!close) {
const tag = this._tags[tagKey]!;
const allowed = isAllowed(tagKey);
if(parent !== undefined) {
parent.appendChild(document.createTextNode(input.substring(mark, allowed ? tagStart : i + 1)));
mark = i + 1;
}
if(!allowed || parent === undefined) {
i = this.parse(input, i + 1, tag, parent, isAllowed);
mark = i + 1;
} else if(c === ']') {
depth--;
if (depth !== 0) {
console.log('Hit depth tagClose', depth);
}
if (depth === 0) {
const paramIndex = paramStart === -1 ? i : paramStart;
let tagKey = input.substring(tagStart + 1, paramIndex).trim().toLowerCase();
if(tagKey.length === 0) {
tagStart = -1;
continue;
}
let element: HTMLElement | undefined;
if(tag instanceof BBCodeTextTag) {
i = this.parse(input, i + 1, tag, undefined, isAllowed);
element = tag.createElement(this, parent, param, input.substring(mark, input.lastIndexOf('[', i)));
if(element === undefined) parent.appendChild(document.createTextNode(input.substring(tagStart, i + 1)));
} else {
element = tag.createElement(this, parent, param, '');
if(element === undefined) parent.appendChild(document.createTextNode(input.substring(tagStart, i + 1)));
if(!tag.noClosingTag)
i = this.parse(input, i + 1, tag, element !== undefined ? element : parent, isAllowed);
if(element === undefined)
parent.appendChild(document.createTextNode(input.substring(input.lastIndexOf('[', i), i + 1)));
const param = paramStart > tagStart ? input.substring(paramStart + 1, i).trim() : '';
const close = tagKey[0] === '/';
if(close) tagKey = tagKey.substr(1).trim();
if(this._tags[tagKey] === undefined) {
tagStart = -1;
continue;
}
mark = i + 1;
this._currentTag = currentTag;
if(element === undefined) continue;
(<HTMLElement & {bbcodeTag: string}>element).bbcodeTag = tagKey;
if(param.length > 0) (<HTMLElement & {bbcodeParam: string}>element).bbcodeParam = param;
} else if(self !== undefined) { //tslint:disable-line:curly
if(self.tag === tagKey) {
if(parent !== undefined)
parent.appendChild(document.createTextNode(input.substring(mark, selfAllowed ? tagStart : i + 1)));
return i;
}
if(!selfAllowed) return mark - 1;
if(isAllowed(tagKey))
this.warning(`Unexpected closing ${tagKey} tag. Needed ${self.tag} tag instead.`);
} else if(isAllowed(tagKey)) this.warning(`Found closing ${tagKey} tag that was never opened.`);
if(!close) {
const tag = this._tags[tagKey]!;
const allowed = isAllowed(tagKey);
if(parent !== undefined) {
parent.appendChild(document.createTextNode(input.substring(mark, allowed ? tagStart : i + 1)));
mark = i + 1;
}
if(!allowed || parent === undefined) {
i = this.parse(input, i + 1, tag, parent, isAllowed);
mark = i + 1;
continue;
}
let element: HTMLElement | undefined;
if(tag instanceof BBCodeTextTag) {
i = this.parse(input, i + 1, tag, undefined, isAllowed);
element = tag.createElement(this, parent, param, input.substring(mark, input.lastIndexOf('[', i)));
if(element === undefined) parent.appendChild(document.createTextNode(input.substring(tagStart, i + 1)));
} else {
element = tag.createElement(this, parent, param, '');
if(element === undefined) parent.appendChild(document.createTextNode(input.substring(tagStart, i + 1)));
if(!tag.noClosingTag)
i = this.parse(input, i + 1, tag, element !== undefined ? element : parent, isAllowed);
if(element === undefined)
parent.appendChild(document.createTextNode(input.substring(input.lastIndexOf('[', i), i + 1)));
}
mark = i + 1;
this._currentTag = currentTag;
if(element === undefined) continue;
(<HTMLElement & {bbcodeTag: string}>element).bbcodeTag = tagKey;
if(param.length > 0) (<HTMLElement & {bbcodeParam: string}>element).bbcodeParam = param;
} else if(self !== undefined) { //tslint:disable-line:curly
if(self.tag === tagKey) {
if(parent !== undefined)
parent.appendChild(document.createTextNode(input.substring(mark, selfAllowed ? tagStart : i + 1)));
return i;
}
if(!selfAllowed) return mark - 1;
if(isAllowed(tagKey))
this.warning(`Unexpected closing ${tagKey} tag. Needed ${self.tag} tag instead.`);
} else if(isAllowed(tagKey)) this.warning(`Found closing ${tagKey} tag that was never opened.`);
}
}
}
if(mark < input.length && parent !== undefined) {

View File

@ -8,47 +8,74 @@
<link rel="stylesheet" type="text/css" media="screen" href="{{ '/assets/css/style.css?v=' | append: site.github.build_revision | relative_url }}">
<style>
.mac_download_link {
display: block;
float: left;
width: 45px;
height:45px;
text-indent: -5000px;
overflow: hidden;
background: url(assets/images/mac.png) no-repeat bottom left;
margin-left: 18px;
background-size: contain;
.download_link {
clear: both;
margin-left: 25px;
}
.win_download_link {
display: block;
float: left;
width: 45px;
height:45px;
text-indent: -5000px;
overflow: hidden;
background: url(assets/images/win.png) no-repeat bottom right;
background-size: contain;
.download_link a {
color: #da9e0f;
}
.mac_download_link:hover {
background: url(assets/images/mac.png) no-repeat top left;
background-size: contain;
.download_link a:hover {
filter: brightness(1.2);
}
.win_download_link:hover {
background: url(assets/images/win.png) no-repeat top right;
background-size: contain;
filter: brightness(1.2);
.download_link a i {
float: left;
width: 20px;
height: 20px;
padding-right: 5px;
display: inline-block;
}
.download_link.mac a i {
background: url(assets/images/mac.png) no-repeat;
background-size: contain;
margin-top: -1px;
margin-left: -1px;
margin-right: 1px;
}
.download_link.win a i {
background: url(assets/images/win.png) no-repeat;
background-size: contain;
}
.download_link.win {
margin-bottom: 6px;
}
#downloads_small {
height: 45px;
}
#downloads_small h3 {
color: #da9e0f;
font-weight: normal;
}
#downloads_small div small {
color: #7d7d7d;
font-size: 80%;
padding-left: 1px;
}
h1, h2, h3, h4, h5, h6 {
font-weight: normal !important;
}
</style>
{% seo %}
</head>
@ -57,17 +84,24 @@
<!-- HEADER -->
<div id="header_wrap" class="outer">
<header class="inner">
{% if site.github.is_project_page %}
<a id="forkme_banner" href="{{ site.github.repository_url }}">View on GitHub</a>
{% endif %}
<a id="forkme_banner" href="{{ site.github.repository_url }}">View on GitHub</a>
<h1 id="project_title">{{ site.title | default: site.github.repository_name }}</h1>
<h2 id="project_tagline">{{ site.description | default: site.github.project_tagline }}</h2>
{% if site.show_downloads %}
<section id="downloads_small">
<a class="win_download_link" href="{{ site.download.win_url }}">Download for Windows</a>
<a class="mac_download_link" href="{{ site.download.mac_url }}">Download for MacOS</a>
<h3>Downloads</h3>
<div class="download_link win">
<a href="{{ site.download.win_url }}"><i></i> Windows</a>
<small>(72 MB)</small>
</div>
<div class="download_link mac">
<a href="{{ site.download.mac_url }}"><i></i> MacOS</a>
<small>(68 MB)</small>
</div>
</section>
{% endif %}
</header>

View File

@ -2,14 +2,6 @@
layout: rising
---
# Download Now!
F-Chat Rising v1
[Windows](https://github.com/mrstallion/flist-rising/releases/download/v3.0.13-rising-v1/F-Chat.Rising.Setup.exe) (72 MB)
[MacOS](https://github.com/mrstallion/flist-rising/releases/download/v3.0.13-rising-v1/F-Chat.Rising.dmg) (68 MB)
# Features

Binary file not shown.

View File

@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline'; img-src file: data: https://static.f-list.net; connect-src *">
<meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src file: data: https://static.f-list.net; connect-src *">
<title>F-Chat</title>
<link href="fa.css" rel="stylesheet">
</head>

View File

@ -11,6 +11,8 @@
"build:dist": "node ../webpack production",
"watch": "node ../webpack watch",
"start": "../node_modules/.bin/electron app",
"startDebugMain": "../node_modules/.bin/electron --serve --inspect-brk=9229 app",
"startDebugRender": "../node_modules/.bin/electron --remote-debugging-port=9229 app",
"pack": "node ./pack"
}
}

View File

@ -130,7 +130,10 @@ module.exports = function(mode) {
mainConfig.devtool = rendererConfig.devtool = 'source-map';
rendererConfig.plugins.push(new OptimizeCssAssetsPlugin());
} else {
mainConfig.devtool = rendererConfig.devtool = 'none';
// mainConfig.devtool = rendererConfig.devtool = 'none';
mainConfig.devtool = 'inline-source-map';
rendererConfig.devtool = 'inline-source-map';
}
return [mainConfig, rendererConfig];
};

View File

@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline'; img-src https://static.f-list.net">
<meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src https://static.f-list.net">
<title>F-Chat</title>
<link href="fa.css" rel="stylesheet">
</head>
@ -11,4 +11,4 @@
<script type="text/javascript" src="common.js"></script>
<script type="text/javascript" src="window.js"></script>
</body>
</html>
</html>

View File

@ -24,6 +24,8 @@ function compilerCallback(err, stats) {
if(mode !== 'watch' && stats.hasErrors()) process.exitCode = 2;
}
console.log(config);
const compiler = webpack(config);
if(mode === 'watch') compiler.watch({}, compilerCallback);
else compiler.run(compilerCallback);
else compiler.run(compilerCallback);