Skip to content

Commit

Permalink
p3x-robot sunday release 2018-5-15 01:10:12
Browse files Browse the repository at this point in the history
  • Loading branch information
p3x-robot committed May 14, 2018
1 parent df0c8f1 commit 312f282
Show file tree
Hide file tree
Showing 30 changed files with 170 additions and 97 deletions.
2 changes: 1 addition & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ UrlToolkit {

---

[**P3X-GITLIST**](https://pages.corifeus.com/gitlist) Build v2.0.18-595
[**P3X-GITLIST**](https://pages.corifeus.com/gitlist) Build v2.0.26-598

[![Like Corifeus @ Facebook](https://img.shields.io/badge/LIKE-Corifeus-3b5998.svg)](https://www.facebook.com/corifeus.software) [![Donate for Corifeus / P3X](https://img.shields.io/badge/Donate-Corifeus-003087.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QZVM4V6HVZJW6) [![Contact Corifeus / P3X](https://img.shields.io/badge/Contact-P3X-ff9900.svg)](https://www.patrikx3.com/en/front/contact)

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@



# 🤖 P3X Gitlist v2.0.18-595
# 🤖 P3X Gitlist v2.0.26-598

This is an open-source project. Star this repository if you like it, or even donate! Thank you so much! :)

Expand Down Expand Up @@ -145,7 +145,7 @@ npm run watch

---

[**P3X-GITLIST**](https://pages.corifeus.com/gitlist) Build v2.0.18-595
[**P3X-GITLIST**](https://pages.corifeus.com/gitlist) Build v2.0.26-598

[![Like Corifeus @ Facebook](https://img.shields.io/badge/LIKE-Corifeus-3b5998.svg)](https://www.facebook.com/corifeus.software) [![Donate for Corifeus / P3X](https://img.shields.io/badge/Donate-Corifeus-003087.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QZVM4V6HVZJW6) [![Contact Corifeus / P3X](https://img.shields.io/badge/Contact-P3X-ff9900.svg)](https://www.patrikx3.com/en/front/contact)

Expand Down
2 changes: 1 addition & 1 deletion artifacts/php-7.2-ubuntu.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ sudo apt upgrade -y

---

[**P3X-GITLIST**](https://pages.corifeus.com/gitlist) Build v2.0.18-595
[**P3X-GITLIST**](https://pages.corifeus.com/gitlist) Build v2.0.26-598

[![Like Corifeus @ Facebook](https://img.shields.io/badge/LIKE-Corifeus-3b5998.svg)](https://www.facebook.com/corifeus.software) [![Donate for Corifeus / P3X](https://img.shields.io/badge/Donate-Corifeus-003087.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QZVM4V6HVZJW6) [![Contact Corifeus / P3X](https://img.shields.io/badge/Contact-P3X-ff9900.svg)](https://www.patrikx3.com/en/front/contact)

Expand Down
2 changes: 1 addition & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ require('codemirror/mode/yaml/yaml');

---

[**P3X-GITLIST**](https://pages.corifeus.com/gitlist) Build v2.0.18-595
[**P3X-GITLIST**](https://pages.corifeus.com/gitlist) Build v2.0.26-598

[![Like Corifeus @ Facebook](https://img.shields.io/badge/LIKE-Corifeus-3b5998.svg)](https://www.facebook.com/corifeus.software) [![Donate for Corifeus / P3X](https://img.shields.io/badge/Donate-Corifeus-003087.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QZVM4V6HVZJW6) [![Contact Corifeus / P3X](https://img.shields.io/badge/Contact-P3X-ff9900.svg)](https://www.patrikx3.com/en/front/contact)

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "p3x-gitlist",
"version": "2.0.18-595",
"version": "2.0.26-598",
"corifeus": {
"prefix": "p3x-",
"publish": false,
Expand Down Expand Up @@ -50,6 +50,7 @@
},
"homepage": "https://pages.corifeus.com/gitlist",
"dependencies": {
"animate.css": "^3.6.1",
"codemirror": "^5.37.0",
"highlight.js": "^9.12.0",
"jquery": "^3.3.1",
Expand Down
2 changes: 1 addition & 1 deletion public/css/bootstrap-cerulean.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/css/bootstrap-cosmo.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/css/bootstrap-cyborg.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/css/bootstrap-darkly.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/css/bootstrap-default.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/css/bootstrap-flatly.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/css/bootstrap-journal.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/css/bootstrap-lumen.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/css/bootstrap-paper.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/css/bootstrap-readable.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/css/bootstrap-sandstone.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/css/bootstrap-simplex.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/css/bootstrap-slate.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/css/bootstrap-spacelab.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/css/bootstrap-superhero.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/css/bootstrap-united.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/css/bootstrap-yeti.css

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions public/js/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ global.jQuery = require('jquery')
global.$ = global.jQuery;

require('bootstrap');
require('snackbarjs');
require('animate.css');

global.marked = require('marked')
global.htmlEncode = require('js-htmlencode')
Expand Down
2 changes: 0 additions & 2 deletions public/js/clone-buttons.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
document.addEventListener("DOMContentLoaded", function(event) {

require('snackbarjs');

const cloneButtonSSH = $('#clone-button-ssh');
const cloneButtonHTTP = $('#clone-button-http');
const cloneInputSSH = $('#clone-input-ssh');
Expand Down
140 changes: 95 additions & 45 deletions public/js/code-mirror.js
Original file line number Diff line number Diff line change
@@ -1,61 +1,111 @@
document.addEventListener("DOMContentLoaded", function(event) {


const sourceCode = $('#sourcecode');
if (sourceCode.length) {
const value = sourceCode.text();
const mode = sourceCode.attr('language');
const pre = sourceCode.get(0);

const codeMirror = $('.CodeMirror');
const buttonScroll = $('#p3x-gitlist-file-button-scroll');
const buttonFull = $('#p3x-gitlist-file-button-full');
const codeMirrorHeight = 300;
const codeSmall = $('#p3x-gitlist-file-small');
const codeBig = $('#p3x-gitlist-file-codemirror');

const Cookies = require('js-cookie')
const cookieName = 'p3x-gitlist-codemirror-size'
const createCodeMirror = () => {
codeSmall.hide();
codeBig.show();
const mode = sourceCode.attr('language');
const pre = sourceCode.get(0);

const currentSizing = Cookies.get(cookieName)
const cookieSettings = {
path: '/',
expires: 3650
}
const codeMirror = $('.CodeMirror');
const buttonScroll = $('#p3x-gitlist-file-button-scroll');
const buttonFull = $('#p3x-gitlist-file-button-full');
const codeMirrorHeight = 300;

const setScroll = () => {
buttonFull.removeClass('active')
buttonScroll.addClass('active')
codeMirror.css('height', codeMirrorHeight)
gitlist.viewer.setSize(null, codeMirrorHeight);
Cookies.set(cookieName, 'scroll', cookieSettings)
}
const Cookies = require('js-cookie')
const cookieName = 'p3x-gitlist-codemirror-size'

const currentSizing = Cookies.get(cookieName)
const cookieSettings = {
path: '/',
expires: 3650
}

const setScroll = () => {
buttonFull.removeClass('active')
buttonScroll.addClass('active')
codeMirror.css('height', codeMirrorHeight)
gitlist.viewer.setSize(null, codeMirrorHeight);
Cookies.set(cookieName, 'scroll', cookieSettings)
}

buttonScroll.click(setScroll)

buttonScroll.click(setScroll)
const setFull = () => {
buttonScroll.removeClass('active')
buttonFull.addClass('active')
codeMirror.css('height', 'auto')
gitlist.viewer.setSize(null, '100%');
Cookies.set(cookieName, 'full', cookieSettings)
}

const setFull = () => {
buttonScroll.removeClass('active')
buttonFull.addClass('active')
codeMirror.css('height', 'auto')
gitlist.viewer.setSize(null, '100%');
Cookies.set(cookieName, 'full', cookieSettings)
buttonFull.click(setFull)

gitlist.viewer = CodeMirror(function(elt) {
pre.parentNode.replaceChild(elt, pre);
}, {
value: value,
lineNumbers: true,
matchBrackets: true,
lineWrapping: true,
readOnly: true,
mode: mode,
theme: window.gitlist.getActualThemeCodemirror(),
});
if (currentSizing === 'full') {
setFull()
} else {
setScroll()
}
}

buttonFull.click(setFull)

gitlist.viewer = CodeMirror(function(elt) {
pre.parentNode.replaceChild(elt, pre);
}, {
value: value,
lineNumbers: true,
matchBrackets: true,
lineWrapping: true,
readOnly: true,
mode: mode,
theme: window.gitlist.getActualThemeCodemirror(),
});
if (currentSizing === 'full') {
setFull()
const value = sourceCode.text();
const maxSize = 64;
const size = Math.ceil(value.length / 1024);
if (size > maxSize) {
codeBig.hide();
codeSmall.show();
const codeSmallButton = $('#p3x-gitlist-file-small-button');

const animate = 'animated bounce'
let timeout;
setTimeout(() => {
$.snackbar({
htmlAllowed: true,
content: `
The maximum auto parsed code size is ${maxSize} KB.<br/>
This code is ${size} KB.<br/>
To see the parsed code, click the <strong>Parse code</strong> button.
`,
timeout: 15000,
});

let flag = true;
timeout = setInterval(() => {
if (flag) {
codeSmall.removeClass(animate)
} else {
codeSmall.addClass(animate)
}
flag = !flag;
}, 2000)
codeSmall.addClass(animate)

}, 250)

codeSmallButton.click(() => {
clearInterval(timeout)
codeBig.show();
codeSmall.hide();
createCodeMirror();
})
} else {
setScroll()
createCodeMirror();
}
}
})
45 changes: 27 additions & 18 deletions public/js/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ window.gitlist.getActualThemeCodemirror = () => {
}

window.gitlist.setTheme = () => {
if ($body === undefined || window.gitlist.getThemeCookie === undefined) {
if ($body === undefined) {
setTimeout(() => {
window.gitlist.setTheme()
})
Expand Down Expand Up @@ -59,6 +59,16 @@ window.gitlist.setTheme = () => {
}
}

const pushHash = (hash) => {
if(history.pushState) {
const pushState = location.pathname + hash;
history.pushState(null, null, pushState);
}
else {
location.hash = hash;
}

}

$(function () {

Expand All @@ -73,7 +83,8 @@ $(function () {
}
if (href.startsWith('#')) {
e.preventDefault()
const el = document.getElementById(href.substring(1));
const hash = href.substring(1);
const el = document.getElementById(hash);
if (el === null) {
return;
}
Expand All @@ -82,7 +93,7 @@ $(function () {
block: "center",

})

pushHash(href)
}
})
}
Expand All @@ -93,14 +104,6 @@ $(function () {

});

document.addEventListener("DOMContentLoaded", function() {
if (window.gitlist.lastload !== undefined) {
window.gitlist.lastloadSpan = Date.now() - window.gitlist.lastload;
}
$('.p3x-gitlist-overlay').remove();
})



global.gitlist.scrollHash = function(element, event) {
const url = new URL(element.href)
Expand All @@ -117,13 +120,19 @@ global.gitlist.scrollHash = function(element, event) {

if (event !== undefined) {
event.preventDefault()
if(history.pushState) {
const pushState = location.pathname + url.hash;
history.pushState(null, null, pushState);
}
else {
location.hash = url.hash;
}
pushHash(url.hash)
}
return false;
}


document.addEventListener("DOMContentLoaded", function() {
if (window.gitlist.lastload !== undefined) {
window.gitlist.lastloadSpan = Date.now() - window.gitlist.lastload;
}
$('.p3x-gitlist-overlay').remove();
global.gitlist.scrollHash(location)
})



1 change: 0 additions & 1 deletion public/js/markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ We are not loading everything, since it is about 500kb`)
folder: 'svg',
ext: '.svg',
}));
global.gitlist.scrollHash(location)
}

});
8 changes: 1 addition & 7 deletions public/less/blame-view.less
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,7 @@
td.blame-info {
}
td.blame-line {
pre {
background-color: lighten(@navbar-inverse-bg, 5%);
color: @navbar-inverse-color;
border-color: @navbar-inverse-border;
overflow-x: auto;
white-space:pre-wrap;
}

}
tr {
}
Expand Down
16 changes: 16 additions & 0 deletions public/less/default.less
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,22 @@
}
}


.p3x-gitlist-dark {
#snackbar-container > div {
border: 1px solid @navbar-default-border;
}

pre {
background-color: lighten(@navbar-inverse-bg, 5%);
color: @navbar-inverse-color;
border-color: @navbar-inverse-border;
overflow-x: auto;
white-space:pre-wrap;
}
}


.header {
margin-bottom: @line-height-computed;
}
Expand Down
6 changes: 5 additions & 1 deletion twig/file.twig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@

{% if fileType != 'image' and fileType != 'markdown' %}
<div class="pull-left">
<div class="btn-group btn-toggle">
<div id="p3x-gitlist-file-small">
<button id="p3x-gitlist-file-small-button" class="btn btn-sm btn-primary">Parse code</button>
</div>

<div class="btn-group btn-toggle" id="p3x-gitlist-file-codemirror">
<button id="p3x-gitlist-file-button-scroll" class="btn btn-sm btn-primary">Scroll mode</button>
<button id="p3x-gitlist-file-button-full" class="btn btn-sm btn-primary">Full height</button>
</div>
Expand Down

0 comments on commit 312f282

Please sign in to comment.