Skip to content
This repository has been archived by the owner on Apr 21, 2021. It is now read-only.

Commit

Permalink
preview links with hash correctly; cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
tom-sap committed Mar 8, 2017
1 parent b097248 commit 13f08d4
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 16 deletions.
5 changes: 3 additions & 2 deletions app/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

html,
body { width: 100%; height: 100%; margin: 0; padding: 0; color: #333; overflow: hidden; zoom: reset;
font: 14px -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
-webkit-font-smoothing: subpixel-antialiased;
font: caption; -webkit-font-smoothing: subpixel-antialiased;
}
/* font: 14px -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; */

body * { box-sizing: border-box; }
18 changes: 11 additions & 7 deletions app/bookmarks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ const issueTypes = {
default: 'ion-ios-star-outline',
};

const statusIconCls = {
failure: 'ion-md-alert',
success: 'ion-md-checkmark-circle',
progress: 'ion-md-time'
};


const DEFAULT_REPO_NAME = 'Pages'; // for ungrouped pages


Expand Down Expand Up @@ -49,19 +56,16 @@ function onClick (e) {


function updateBuildStatus (pr, status) {
const ionCls = {
failure: 'ion-md-alert',
success: 'ion-md-checkmark-circle',
progress: 'ion-md-time'
};
const prBox = $(`.pr-${pr.id}`);
const statusBox = prBox.find('.build-status');
const statusIcon = prBox.find('.build-status .icon');
const progBoxIn = prBox.find('.build-progress-inner');

if (!status) return statusBox.hide();

const result = status.result ? status.result : 'progress';
if (result) statusBox.addClass(result);
if (ionCls[result]) statusIcon.addClass(ionCls[result]);
if (statusIconCls[result]) statusIcon.addClass(statusIconCls[result]);
statusBox[0].title = status.result || 'Open build job';
statusBox[0].href = pr.buildUrl;

Expand All @@ -78,7 +82,7 @@ function monitorPr (pr) {
pr.buildUrl = url;
return jenkins.getStatus(url);
})
.then(status => status && updateBuildStatus(pr, status));
.then(status => updateBuildStatus(pr, status));
}


Expand Down
1 change: 1 addition & 0 deletions app/contextmenu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ function getTemplate (type) {
function parseLink (link) {
link = '' + link;
if (link.indexOf('http') !== 0) link = config.get('baseUrl') + link;
console.log(link);
return link;
}

Expand Down
7 changes: 4 additions & 3 deletions app/frame/webview.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,10 @@ function onClick (e) {
const el = e.target;

if (e.metaKey || e.ctrlKey) {
if (el.tagName === 'IMG') msg('showPreview', e.target.getAttribute('src'));
else if (el.tagName === 'A') msg('showPreview', e.target.getAttribute('href'));
if (el.closest('a')) {
const a = el.closest('a');
if (el.tagName === 'IMG') msg('showPreview', e.target.src);
else if (a) msg('showPreview', a.href);
if (a) {
e.stopPropagation();
e.preventDefault();
}
Expand Down
6 changes: 4 additions & 2 deletions app/nav/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
height: 40px;
margin: 14px auto;
border-radius: 3px;
background: #2C384D; text-decoration: none; position: relative;
background: #2C384D;
text-decoration: none;
position: relative;
transition: background-color .3s ease-out;
}
.nav-btn:hover { background: #43516D; }
Expand Down Expand Up @@ -56,7 +58,7 @@
.subnav-section a:hover { text-decoration: underline; }

.subnav-section h1 { font-size: 14px; font-weight: 300; line-height: 12px; margin: 0; color: #eee;
padding: 13px 0 0; height: 38px; text-transform: uppercase; text-align: center;
padding: 13px 0 0; height: 38px; text-transform: uppercase; text-align: center; user-select: none;
}
.subnav-section h2 { font-size: 14px; line-height: 17px; font-weight: 600; margin: 0; }

Expand Down
2 changes: 1 addition & 1 deletion app/preview/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<input id="address" readonly />
<div id="page"></div>
<script>
const url = location.search.substr(1);
const url = location.href.split('?').pop();
const tpl = `<webview id="frame" src="${url}" partition="persist:github"></webview>`;
const page = document.getElementById('page');
const inp = document.getElementById('address');
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ app.on('ready', () => {

win = new BrowserWindow({
title: 'Github Browser',
icon:'assets/icon.png',
icon: __dirname + '/assets/icon.png',
show: false,
// vibrancy: 'sidebar',
// transparent: true,
Expand Down

0 comments on commit 13f08d4

Please sign in to comment.