mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-24 07:01:48 +00:00
refactor build config
This commit is contained in:
BIN
src/app-logo.png
Normal file
BIN
src/app-logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 42 KiB |
@@ -1,5 +1,6 @@
|
||||
/* global angular */
|
||||
angular.module('codexen', [
|
||||
'codexen.shared',
|
||||
'ngSanitize',
|
||||
'ui.select',
|
||||
'ui.ace',
|
||||
@@ -8,4 +9,5 @@ angular.module('codexen', [
|
||||
'satellizer',
|
||||
'angular-md5',
|
||||
'templates'])
|
||||
.constant('appName', 'main')
|
||||
angular.module('templates', [])
|
||||
73
src/browser/main/index.html
Normal file
73
src/browser/main/index.html
Normal file
@@ -0,0 +1,73 @@
|
||||
<!DOCTYPE html>
|
||||
<html ng-app="codexen">
|
||||
<head>
|
||||
<title>
|
||||
CodeXen App
|
||||
</title>
|
||||
|
||||
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/>
|
||||
<meta name="description" content="CodeXen - Short code storage service">
|
||||
|
||||
<title>Codexen!</title>
|
||||
|
||||
<link rel="stylesheet" href="../vendor/css/font-awesome.css" media="screen" title="no title" charset="utf-8">
|
||||
|
||||
<!-- inject:css -->
|
||||
<link rel="stylesheet" href="styles/app.css">
|
||||
<link rel="stylesheet" href="../shared/styles/bootstrap.css">
|
||||
<!-- endinject -->
|
||||
|
||||
</head>
|
||||
<body ng-controller="AppController as app">
|
||||
<div side-nav id="side-view"></div>
|
||||
<div ui-view name="main-view" id="main-view"></div>
|
||||
|
||||
<script src="../vendor/ace.js"></script>
|
||||
<script src="../vendor/angular.js"></script>
|
||||
<script src="../vendor/angular-sanitize.js"></script>
|
||||
<script src="../vendor/angular-ui-router.js"></script>
|
||||
<script src="../vendor/ui-bootstrap-tpls.js"></script>
|
||||
<script src="../vendor/select.js"></script>
|
||||
<script src="../vendor/satellizer.js"></script>
|
||||
<script src="../vendor/angular-md5.js"></script>
|
||||
<script src="../vendor/moment.js"></script>
|
||||
|
||||
<!-- inject:js -->
|
||||
<script src="app.js"></script>
|
||||
<script src="config/states.js"></script>
|
||||
<script src="controllers/AppController.js"></script>
|
||||
<script src="filters/from-now.js"></script>
|
||||
<script src="filters/search-snippets.js"></script>
|
||||
<script src="directives/btn-delete-snippet.js"></script>
|
||||
<script src="directives/btn-edit-snippet.js"></script>
|
||||
<script src="directives/btn-new-snippet.js"></script>
|
||||
<script src="directives/side-nav.js"></script>
|
||||
<script src="directives/snippet-item.js"></script>
|
||||
<script src="directives/tag-item.js"></script>
|
||||
<script src="directives/tag-list.js"></script>
|
||||
<script src="services/Modal.js"></script>
|
||||
<script src="services/Settings.js"></script>
|
||||
<script src="services/Tag.js"></script>
|
||||
<script src="services/User.js"></script>
|
||||
<script src="controllers/directives/SideNavController.js"></script>
|
||||
<script src="controllers/modals/DeleteSnippetModalController.js"></script>
|
||||
<script src="controllers/modals/EditSnippetModalController.js"></script>
|
||||
<script src="controllers/modals/NewSnippetModalController.js"></script>
|
||||
<script src="controllers/states/AuthRegisterController.js"></script>
|
||||
<script src="controllers/states/AuthSignInController.js"></script>
|
||||
<script src="controllers/states/HomeController.js"></script>
|
||||
<script src="controllers/states/SettingsController.js"></script>
|
||||
<script src="controllers/states/SnippetsDetailController.js"></script>
|
||||
<script src="controllers/states/SnippetsListController.js"></script>
|
||||
<script src="../shared/shared.js"></script>
|
||||
<script src="../shared/config/ace.js"></script>
|
||||
<script src="../shared/config/env.js"></script>
|
||||
<script src="../shared/config/satellizer.js"></script>
|
||||
<script src="../shared/directives/ui-ace.js"></script>
|
||||
<script src="../shared/services/Snippet.js"></script>
|
||||
<!-- endinject -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
39
src/browser/main/index.inject.html
Normal file
39
src/browser/main/index.inject.html
Normal file
@@ -0,0 +1,39 @@
|
||||
<!DOCTYPE html>
|
||||
<html ng-app="codexen">
|
||||
<head>
|
||||
<title>
|
||||
CodeXen App
|
||||
</title>
|
||||
|
||||
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/>
|
||||
<meta name="description" content="CodeXen - Short code storage service">
|
||||
|
||||
<title>Codexen!</title>
|
||||
|
||||
<link rel="stylesheet" href="../vendor/css/font-awesome.css" media="screen" title="no title" charset="utf-8">
|
||||
|
||||
<!-- inject:css -->
|
||||
<!-- endinject -->
|
||||
|
||||
</head>
|
||||
<body ng-controller="AppController as app">
|
||||
<div side-nav id="side-view"></div>
|
||||
<div ui-view name="main-view" id="main-view"></div>
|
||||
|
||||
<script src="../vendor/ace.js"></script>
|
||||
<script src="../vendor/angular.js"></script>
|
||||
<script src="../vendor/angular-sanitize.js"></script>
|
||||
<script src="../vendor/angular-ui-router.js"></script>
|
||||
<script src="../vendor/ui-bootstrap-tpls.js"></script>
|
||||
<script src="../vendor/select.js"></script>
|
||||
<script src="../vendor/satellizer.js"></script>
|
||||
<script src="../vendor/angular-md5.js"></script>
|
||||
<script src="../vendor/moment.js"></script>
|
||||
|
||||
<!-- inject:js -->
|
||||
<!-- endinject -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
378
src/browser/main/styles/app.css
Normal file
378
src/browser/main/styles/app.css
Normal file
@@ -0,0 +1,378 @@
|
||||
.new-snippet-modal .ace_editor {
|
||||
height: 200px;
|
||||
}
|
||||
#side-view .nav-control-group {
|
||||
margin: 0 5px;
|
||||
}
|
||||
#side-view ul.nav.nav-pills {
|
||||
margin-top: 10px;
|
||||
}
|
||||
#side-view ul.nav.nav-pills li hr {
|
||||
margin: 5px 0;
|
||||
border-top: none;
|
||||
border-bottom: solid 1px #001a20;
|
||||
}
|
||||
#side-view ul.nav.nav-pills li a {
|
||||
border-top-right-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
-webkit-transition: 0.2s;
|
||||
transition: 0.2s;
|
||||
}
|
||||
#side-view ul.nav.nav-pills li.active > a,
|
||||
#side-view ul.nav.nav-pills .nav-pills > li.active > a:hover,
|
||||
#side-view ul.nav.nav-pills .nav-pills > li.active > a:focus {
|
||||
background-color: #004b5f;
|
||||
}
|
||||
/*
|
||||
* ui-select
|
||||
* http://github.com/angular-ui/ui-select
|
||||
* Version: 0.11.2 - 2015-03-17T04:08:46.478Z
|
||||
* License: MIT
|
||||
*/
|
||||
.ui-select-highlight {
|
||||
font-weight: bold;
|
||||
}
|
||||
.ui-select-offscreen {
|
||||
clip: rect(0 0 0 0) !important;
|
||||
width: 1px !important;
|
||||
height: 1px !important;
|
||||
border: 0 !important;
|
||||
margin: 0 !important;
|
||||
padding: 0 !important;
|
||||
overflow: hidden !important;
|
||||
position: absolute !important;
|
||||
outline: 0 !important;
|
||||
left: 0px !important;
|
||||
top: 0px !important;
|
||||
}
|
||||
.ng-dirty.ng-invalid > a.select2-choice {
|
||||
border-color: #d44950;
|
||||
}
|
||||
.select2-result-single {
|
||||
padding-left: 0;
|
||||
}
|
||||
.select2-locked > .select2-search-choice-close {
|
||||
display: none;
|
||||
}
|
||||
.select-locked > .ui-select-match-close {
|
||||
display: none;
|
||||
}
|
||||
body > .select2-container.open {
|
||||
z-index: 9999;
|
||||
}
|
||||
.selectize-input.selectize-focus {
|
||||
border-color: #007fbb !important;
|
||||
}
|
||||
.selectize-control > .selectize-input > input {
|
||||
width: 100%;
|
||||
}
|
||||
.selectize-control > .selectize-dropdown {
|
||||
width: 100%;
|
||||
}
|
||||
.ng-dirty.ng-invalid > div.selectize-input {
|
||||
border-color: #d44950;
|
||||
}
|
||||
.btn-default-focus {
|
||||
color: #333;
|
||||
background-color: #ebebeb;
|
||||
border-color: #adadad;
|
||||
text-decoration: none;
|
||||
outline: 5px auto -webkit-focus-ring-color;
|
||||
outline-offset: -2px;
|
||||
box-shadow: inset 0 1px 1px rgba(0,0,0,0.075), 0 0 8px rgba(102,175,233,0.6);
|
||||
}
|
||||
.ui-select-bootstrap .ui-select-toggle {
|
||||
position: relative;
|
||||
border-radius: $input-border-radius;
|
||||
}
|
||||
.ui-select-bootstrap .ui-select-toggle .ui-select-placeholder {
|
||||
color: #99b2b8;
|
||||
}
|
||||
.ui-select-bootstrap .ui-select-toggle > .caret {
|
||||
position: absolute;
|
||||
height: 10px;
|
||||
top: 50%;
|
||||
right: 10px;
|
||||
margin-top: -2px;
|
||||
}
|
||||
.input-group > .ui-select-bootstrap.dropdown {
|
||||
/* Instead of relative */
|
||||
position: static;
|
||||
}
|
||||
.input-group > .ui-select-bootstrap > input.ui-select-search.form-control {
|
||||
border-radius: $input-border-radius;
|
||||
border-top-right-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
}
|
||||
.ui-select-bootstrap > .ui-select-match > .btn {
|
||||
/* Instead of center because of .btn */
|
||||
text-align: left !important;
|
||||
padding-right: 25px;
|
||||
border-radius: $input-border-radius;
|
||||
border: solid 1px #001a20;
|
||||
}
|
||||
.ui-select-bootstrap > .ui-select-match > .caret {
|
||||
position: absolute;
|
||||
top: 45%;
|
||||
right: 15px;
|
||||
}
|
||||
.ui-select-bootstrap > .ui-select-choices {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
max-height: 200px;
|
||||
overflow-x: hidden;
|
||||
margin-top: -1px;
|
||||
}
|
||||
body > .ui-select-bootstrap.open {
|
||||
z-index: 1000;
|
||||
}
|
||||
.ui-select-multiple.ui-select-bootstrap {
|
||||
height: auto;
|
||||
padding: 3px 3px 0 10px;
|
||||
}
|
||||
.ui-select-multiple.ui-select-bootstrap.open {
|
||||
border-color: #52dcff;
|
||||
outline: 0;
|
||||
box-shadow: inset 0 1px 1px rgba(0,0,0,0.075), 0 0 8px rgba(82,220,255,0.6);
|
||||
}
|
||||
.ui-select-multiple.ui-select-bootstrap input.ui-select-search {
|
||||
background-color: transparent !important;
|
||||
border: none;
|
||||
outline: none;
|
||||
height: 1.666666em;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
.ui-select-multiple.ui-select-bootstrap .ui-select-match .close {
|
||||
font-size: 1.6em;
|
||||
line-height: 0.75;
|
||||
}
|
||||
.ui-select-multiple.ui-select-bootstrap .ui-select-match-item {
|
||||
outline: 0;
|
||||
margin: 0 3px 3px 0;
|
||||
}
|
||||
.ui-select-multiple .ui-select-match-item {
|
||||
position: relative;
|
||||
}
|
||||
.ui-select-multiple .ui-select-match-item.dropping-before:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 100%;
|
||||
height: 100%;
|
||||
margin-right: 2px;
|
||||
border-left: 1px solid #428bca;
|
||||
}
|
||||
.ui-select-multiple .ui-select-match-item.dropping-after:after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 100%;
|
||||
height: 100%;
|
||||
margin-left: 2px;
|
||||
border-right: 1px solid #428bca;
|
||||
}
|
||||
.ui-select-bootstrap .ui-select-choices-row>a {
|
||||
display: block;
|
||||
padding: 3px 20px;
|
||||
clear: both;
|
||||
font-weight: 400;
|
||||
line-height: 1.42857143;
|
||||
color: #99b2b8;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.ui-select-bootstrap .ui-select-choices-row>a:hover,
|
||||
.ui-select-bootstrap .ui-select-choices-row>a:focus {
|
||||
text-decoration: none;
|
||||
color: #fff;
|
||||
background-color: #004b5f;
|
||||
}
|
||||
.ui-select-bootstrap .ui-select-choices-row.active>a {
|
||||
color: #fff;
|
||||
text-decoration: none;
|
||||
outline: 0;
|
||||
background-color: #004b5f;
|
||||
}
|
||||
.ui-select-bootstrap .ui-select-choices-row.disabled>a,
|
||||
.ui-select-bootstrap .ui-select-choices-row.active.disabled>a {
|
||||
color: #777;
|
||||
cursor: not-allowed;
|
||||
background-color: #fff;
|
||||
}
|
||||
.ui-select-match.ng-hide-add,
|
||||
.ui-select-search.ng-hide-add {
|
||||
display: none !important;
|
||||
}
|
||||
.ui-select-bootstrap.ng-dirty.ng-invalid > button.btn.ui-select-match {
|
||||
border-color: #d44950;
|
||||
}
|
||||
.auth-state .panel {
|
||||
margin-top: 50px;
|
||||
}
|
||||
.auth-state h1 {
|
||||
margin: 15px 0;
|
||||
}
|
||||
.auth-state .auth-control {
|
||||
margin: 10px 0;
|
||||
}
|
||||
.home-state {
|
||||
padding: 10px;
|
||||
}
|
||||
.settings-state .panel {
|
||||
margin-top: 15px;
|
||||
}
|
||||
.settings-state h1 {
|
||||
margin: 30px 0;
|
||||
}
|
||||
.settings-state .section h4 {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
.snippets-list-state {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
.snippets-list-state .left-pane {
|
||||
border-right: 1px solid #001a20;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 275px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.snippets-list-state .left-pane .snippet-search {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
height: 50px;
|
||||
left: 0;
|
||||
right: 0;
|
||||
border-right: 1px solid #001a20;
|
||||
padding: 7px 5px;
|
||||
}
|
||||
.snippets-list-state .left-pane .snippet-list {
|
||||
position: absolute;
|
||||
top: 50px;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
.snippets-list-state .left-pane .snippet-list li {
|
||||
cursor: pointer;
|
||||
padding: 5px;
|
||||
border-right: 1px solid #001a20;
|
||||
border-bottom: 1px solid #001a20;
|
||||
}
|
||||
.snippets-list-state .left-pane .snippet-list li:nth-child(even) {
|
||||
background-color: #002b36;
|
||||
}
|
||||
.snippets-list-state .left-pane .snippet-list li:nth-child(odd) {
|
||||
background-color: #00323f;
|
||||
}
|
||||
.snippets-list-state .left-pane .snippet-list li h4 {
|
||||
margin: 0;
|
||||
}
|
||||
.snippets-list-state .left-pane .snippet-list li:hover {
|
||||
background-color: #004b5f;
|
||||
}
|
||||
.snippets-list-state .left-pane .snippet-list li p {
|
||||
margin: 0;
|
||||
}
|
||||
.snippets-list-state .left-pane .snippet-list li p.call-sign {
|
||||
font-size: 0.8em;
|
||||
}
|
||||
.snippets-list-state .left-pane .snippet-list li p.created-at {
|
||||
font-size: 0.8em;
|
||||
opacity: 0.8;
|
||||
}
|
||||
.snippets-list-state .left-pane .snippet-list li.active {
|
||||
color: #fff;
|
||||
background-color: #088cff;
|
||||
}
|
||||
.snippets-list-state .left-pane .snippet-list li.active a {
|
||||
color: #fff;
|
||||
}
|
||||
.snippets-list-state .right-pane {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 275px;
|
||||
right: 0;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
background-color: #00323f;
|
||||
}
|
||||
.snippets-detail-state {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
bottom: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
.snippets-detail-state .detail-header {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
background-color: #003d4d;
|
||||
padding: 5px 10px;
|
||||
height: 50px;
|
||||
border-bottom: solid 1px #001a20;
|
||||
}
|
||||
.snippets-detail-state .detail-header .detail-header-title {
|
||||
color: #d5dfe2;
|
||||
line-height: 40px;
|
||||
font-size: 1.2em;
|
||||
}
|
||||
.snippets-detail-state .detail-header .detail-header-title small {
|
||||
font-size: 0.6em;
|
||||
color: #99b2b8;
|
||||
}
|
||||
.snippets-detail-state .detail-header .detail-header-control {
|
||||
padding: 3px;
|
||||
}
|
||||
.snippets-detail-state .detail-body {
|
||||
position: absolute;
|
||||
top: 50px;
|
||||
width: 100%;
|
||||
bottom: 0;
|
||||
padding: 5px 10px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.snippets-detail-state .detail-body .ace_editor {
|
||||
min-height: 300px;
|
||||
border: solid 1px $border-color;
|
||||
border-radius: 5px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.tags {
|
||||
word-break: break-all;
|
||||
}
|
||||
.tags a {
|
||||
margin: 0 2px;
|
||||
}
|
||||
#side-view {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 200px;
|
||||
background-color: #002b36;
|
||||
border-right: solid 2px #004b5f;
|
||||
box-sizing: border-box;
|
||||
padding: 10px 0 10px 10px;
|
||||
}
|
||||
#main-view {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 200px;
|
||||
right: 0;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
background-color: $bgDarker;
|
||||
}
|
||||
@@ -1,28 +1,9 @@
|
||||
@import '../../shared/styles/_vars'
|
||||
@import '../../shared/styles/mixins/*'
|
||||
|
||||
html
|
||||
overflow: hidden
|
||||
height: 100%
|
||||
|
||||
body
|
||||
height: 100%
|
||||
overflow: auto
|
||||
font-family: "Lato", sans-serif
|
||||
color $textColor
|
||||
background-color: $appBackgroundColor
|
||||
|
||||
label
|
||||
font-family: "Lato", sans-serif
|
||||
color $textColor
|
||||
|
||||
h1, h2, h3, h4, h5
|
||||
color $textColorHighlight
|
||||
margin 0
|
||||
|
||||
textarea
|
||||
resize: vertical
|
||||
|
||||
hr
|
||||
border-color $baseBorderColor
|
||||
@import 'modals/*'
|
||||
@import 'directives/*'
|
||||
@import 'states/*'
|
||||
|
||||
#side-view
|
||||
position:absolute
|
||||
67
src/browser/popup/index.html
Normal file
67
src/browser/popup/index.html
Normal file
@@ -0,0 +1,67 @@
|
||||
<!DOCTYPE html>
|
||||
<html ng-app="codexen.popup">
|
||||
<head>
|
||||
<title>
|
||||
CodeXen App
|
||||
</title>
|
||||
|
||||
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/>
|
||||
<meta name="description" content="CodeXen - Short code storage service">
|
||||
|
||||
<link rel="stylesheet" href="../vendor/css/font-awesome.css" media="screen" title="no title" charset="utf-8">
|
||||
|
||||
<!-- inject:css -->
|
||||
<link rel="stylesheet" href="../shared/styles/bootstrap.css">
|
||||
<!-- endinject -->
|
||||
|
||||
</head>
|
||||
<body class="popup-body" ng-controller="PopUpController">
|
||||
|
||||
<div class="search-block">
|
||||
<input ng-change="filterList(searchNeedle)" search-input id="search-input" type="text" class="form-control" ng-model="searchNeedle" ng-change="refreshResult">
|
||||
</div>
|
||||
|
||||
<div class="result-block row-fluid">
|
||||
<ul id="result-list" class="result-list left-pane">
|
||||
<li ng-click="selectSnippet($index)" ng-repeat="snippet in filteredSnippets" ng-class="{active:$index == selectIndex}"><a href="#"> <span ng-bind="snippet.callSign"></span> <small ng-bind="snippet.description"></small></a></li>
|
||||
</ul>
|
||||
|
||||
<div class="right-pane">
|
||||
<div class="result-detail-control">
|
||||
<button ng-click="writeCode(selectedItem.content)" id="btnClipboard" type="button" name="button" class="btn btn-default"><i class="fa fa-clipboard"></i></button>
|
||||
<!-- <button ng-click="editSnippet(selectedItem.id)" id="btnEdit" type="button" name="button" class="btn btn-default"><i class="fa fa-edit"></i></button> -->
|
||||
<!-- <button id="btnShare" type="button" name="button" class="btn btn-default"><i class="fa fa-share"></i></button> -->
|
||||
</div>
|
||||
<div id="aceView" class="result-detail-content"
|
||||
ui-ace="{
|
||||
showGutter: false,
|
||||
useWrapMode: true,
|
||||
mode:selectedItem.mode.toLowerCase(),
|
||||
onLoad: aceLoaded,
|
||||
theme: 'solarized_dark'
|
||||
}"
|
||||
|
||||
readonly
|
||||
ng-model="selectedItem.content"
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="../vendor/ace.js"></script>
|
||||
<script src="../vendor/angular.js" charset="utf-8"></script>
|
||||
<script src="../vendor/satellizer.js"></script>
|
||||
<script src="../vendor/hotkeys.js" charset="utf-8"></script>
|
||||
|
||||
<!-- inject:js -->
|
||||
<script src="popup.js"></script>
|
||||
<script src="services/snippet.js"></script>
|
||||
<script src="../shared/shared.js"></script>
|
||||
<script src="../shared/config/ace.js"></script>
|
||||
<script src="../shared/config/env.js"></script>
|
||||
<script src="../shared/config/satellizer.js"></script>
|
||||
<script src="../shared/directives/ui-ace.js"></script>
|
||||
<script src="../shared/services/Snippet.js"></script>
|
||||
<!-- endinject -->
|
||||
</body>
|
||||
</html>
|
||||
58
src/browser/popup/index.inject.html
Normal file
58
src/browser/popup/index.inject.html
Normal file
@@ -0,0 +1,58 @@
|
||||
<!DOCTYPE html>
|
||||
<html ng-app="codexen.popup">
|
||||
<head>
|
||||
<title>
|
||||
CodeXen App
|
||||
</title>
|
||||
|
||||
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/>
|
||||
<meta name="description" content="CodeXen - Short code storage service">
|
||||
|
||||
<link rel="stylesheet" href="../vendor/css/font-awesome.css" media="screen" title="no title" charset="utf-8">
|
||||
|
||||
<!-- inject:css -->
|
||||
<!-- endinject -->
|
||||
|
||||
</head>
|
||||
<body class="popup-body" ng-controller="PopUpController">
|
||||
|
||||
<div class="search-block">
|
||||
<input ng-change="filterList(searchNeedle)" search-input id="search-input" type="text" class="form-control" ng-model="searchNeedle" ng-change="refreshResult">
|
||||
</div>
|
||||
|
||||
<div class="result-block row-fluid">
|
||||
<ul id="result-list" class="result-list left-pane">
|
||||
<li ng-click="selectSnippet($index)" ng-repeat="snippet in filteredSnippets" ng-class="{active:$index == selectIndex}"><a href="#"> <span ng-bind="snippet.callSign"></span> <small ng-bind="snippet.description"></small></a></li>
|
||||
</ul>
|
||||
|
||||
<div class="right-pane">
|
||||
<div class="result-detail-control">
|
||||
<button ng-click="writeCode(selectedItem.content)" id="btnClipboard" type="button" name="button" class="btn btn-default"><i class="fa fa-clipboard"></i></button>
|
||||
<!-- <button ng-click="editSnippet(selectedItem.id)" id="btnEdit" type="button" name="button" class="btn btn-default"><i class="fa fa-edit"></i></button> -->
|
||||
<!-- <button id="btnShare" type="button" name="button" class="btn btn-default"><i class="fa fa-share"></i></button> -->
|
||||
</div>
|
||||
<div id="aceView" class="result-detail-content"
|
||||
ui-ace="{
|
||||
showGutter: false,
|
||||
useWrapMode: true,
|
||||
mode:selectedItem.mode.toLowerCase(),
|
||||
onLoad: aceLoaded,
|
||||
theme: 'solarized_dark'
|
||||
}"
|
||||
|
||||
readonly
|
||||
ng-model="selectedItem.content"
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="../vendor/ace.js"></script>
|
||||
<script src="../vendor/angular.js" charset="utf-8"></script>
|
||||
<script src="../vendor/satellizer.js"></script>
|
||||
<script src="../vendor/hotkeys.js" charset="utf-8"></script>
|
||||
|
||||
<!-- inject:js -->
|
||||
<!-- endinject -->
|
||||
</body>
|
||||
</html>
|
||||
192
src/browser/popup/popup.js
Normal file
192
src/browser/popup/popup.js
Normal file
@@ -0,0 +1,192 @@
|
||||
/* global angular */
|
||||
|
||||
var remote = require('remote')
|
||||
var ipc = require('ipc')
|
||||
|
||||
var resultList = document.getElementById('result-list')
|
||||
|
||||
angular.module('codexen.popup', [
|
||||
'codexen.shared',
|
||||
'ui.ace',
|
||||
'satellizer',
|
||||
'cfp.hotkeys'
|
||||
])
|
||||
.constant('appName', 'popup')
|
||||
.controller('PopUpController', function ($scope, Snippet, $auth, $window, hotkeys, $document, $filter) {
|
||||
// Setup Events
|
||||
remote.getCurrentWindow().on('focus', function () {
|
||||
if (!$auth.isAuthenticated()) return hidePopUp()
|
||||
$scope.$apply(focusSearchInput)
|
||||
loadSnippets()
|
||||
})
|
||||
|
||||
hotkeys.bindTo($scope)
|
||||
.add('down', function (e) {
|
||||
nextSnippet()
|
||||
e.preventDefault()
|
||||
})
|
||||
.add('up', function (e) {
|
||||
priorSnippet()
|
||||
e.preventDefault()
|
||||
})
|
||||
.add('right', function (e) {
|
||||
e.preventDefault()
|
||||
})
|
||||
.add('left', function (e) {
|
||||
e.preventDefault()
|
||||
})
|
||||
.add('esc', function (e) {
|
||||
hidePopUp()
|
||||
})
|
||||
.add('shift+tab', function (e) {
|
||||
e.preventDefault()
|
||||
})
|
||||
.add('tab', function (e) {
|
||||
e.preventDefault()
|
||||
})
|
||||
.add('enter', function (e) {
|
||||
writeCode($scope.selectedItem.content)
|
||||
e.preventDefault()
|
||||
})
|
||||
|
||||
$scope.aceLoaded = function (editor) {
|
||||
editor.commands.addCommand({
|
||||
name: 'escape',
|
||||
bindKey: {win: 'esc', mac: 'esc'},
|
||||
exec: function (editor) {
|
||||
editor.blur()
|
||||
$scope.$apply()
|
||||
},
|
||||
readOnly: true
|
||||
})
|
||||
}
|
||||
|
||||
$scope.$on('nextSnippetRequested', function (e) {
|
||||
e.stopPropagation()
|
||||
nextSnippet()
|
||||
})
|
||||
|
||||
$scope.$on('priorSnippetRequested', function (e) {
|
||||
e.stopPropagation()
|
||||
priorSnippet()
|
||||
})
|
||||
|
||||
$scope.$on('snippetSubmitted', function (e) {
|
||||
if ($scope.filteredSnippets.length > 0) ipc.send('writeCode', $scope.selectedItem.content)
|
||||
else console.log('\x07')
|
||||
e.stopPropagation()
|
||||
})
|
||||
|
||||
// Init Data
|
||||
$scope.snippets = []
|
||||
|
||||
Snippet.findMine()
|
||||
.success(function (data) {
|
||||
$scope.snippets = data
|
||||
filterList()
|
||||
})
|
||||
|
||||
// Result Item control
|
||||
$scope.selectIndex = 0
|
||||
|
||||
$scope.selectSnippet = selectSnippet
|
||||
$scope.filterList = filterList
|
||||
$scope.writeCode = writeCode
|
||||
$scope.focusSearchInput = focusSearchInput
|
||||
|
||||
// Search Filter
|
||||
function loadSnippets () {
|
||||
Snippet.findMine()
|
||||
.success(function (data) {
|
||||
$scope.snippets = data
|
||||
filterList()
|
||||
})
|
||||
}
|
||||
|
||||
function filterList (needle) {
|
||||
$scope.filteredSnippets = $filter('filter')($scope.snippets, needle)
|
||||
firstSnippet()
|
||||
}
|
||||
|
||||
function selectSnippet (index) {
|
||||
if (index !== undefined) $scope.selectIndex = index
|
||||
$scope.selectedItem = $scope.filteredSnippets[$scope.selectIndex]
|
||||
}
|
||||
|
||||
function firstSnippet () {
|
||||
$scope.selectIndex = 0
|
||||
selectSnippet($scope.selectIndex)
|
||||
}
|
||||
|
||||
function priorSnippet () {
|
||||
if ($scope.selectIndex > 0) $scope.selectIndex -= 1
|
||||
|
||||
if (resultList.children[$scope.selectIndex].offsetTop < resultList.scrollTop) {
|
||||
resultList.scrollTop -= 33
|
||||
}
|
||||
|
||||
selectSnippet()
|
||||
}
|
||||
|
||||
function nextSnippet () {
|
||||
if ($scope.selectIndex < $scope.filteredSnippets.length - 1) {
|
||||
$scope.selectIndex += 1
|
||||
}
|
||||
|
||||
if (resultList.clientHeight - 33 < resultList.children[$scope.selectIndex].offsetTop - resultList.scrollTop) {
|
||||
resultList.scrollTop += 33
|
||||
}
|
||||
|
||||
selectSnippet()
|
||||
}
|
||||
|
||||
function writeCode (code) {
|
||||
ipc.send('writeCode', code)
|
||||
}
|
||||
|
||||
// Focusing Search Input
|
||||
function focusSearchInput () {
|
||||
document.getElementById('search-input').focus()
|
||||
}
|
||||
|
||||
function hidePopUp () {
|
||||
ipc.send('hidePopUp')
|
||||
}
|
||||
|
||||
})
|
||||
.directive('searchInput', function () {
|
||||
return {
|
||||
restrict: 'A',
|
||||
link: function (scope, el, attr) {
|
||||
el.on('keydown', function (e) {
|
||||
// Down key => Focus on Result list
|
||||
if (e.keyCode === 40) {
|
||||
scope.$emit('nextSnippetRequested')
|
||||
// e.preventDefault()
|
||||
}
|
||||
|
||||
// Up key => Focus on Result list
|
||||
if (e.keyCode === 38) {
|
||||
scope.$emit('priorSnippetRequested')
|
||||
// e.preventDefault()
|
||||
}
|
||||
|
||||
// Up key => Focus on Result list
|
||||
if (e.keyCode === 13) {
|
||||
scope.$emit('snippetSubmitted')
|
||||
}
|
||||
|
||||
// Esc key => Dismiss popup
|
||||
if (e.keyCode === 27) {
|
||||
ipc.send('hidePopUp')
|
||||
e.preventDefault()
|
||||
}
|
||||
|
||||
// TODO: Tab key => Auto complete
|
||||
if (e.keyCode === 9) {
|
||||
e.preventDefault()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -1,5 +1,15 @@
|
||||
/* global angular */
|
||||
angular.module('codexen')
|
||||
angular.module('codexen.popup')
|
||||
.constant('apiUrl', 'http://codexen-server-dev.elasticbeanstalk.com/')
|
||||
.config(function ($authProvider, $httpProvider, apiUrl) {
|
||||
$authProvider.baseUrl = apiUrl
|
||||
|
||||
$httpProvider.defaults.useXDomain = true
|
||||
delete $httpProvider.defaults.headers.common['X-Requested-With']
|
||||
})
|
||||
|
||||
|
||||
angular.module('codexen.popup')
|
||||
.factory('Snippet', function ($http, $auth, apiUrl) {
|
||||
var findByUser = function (user) {
|
||||
var url = apiUrl + 'snippets/search'
|
||||
59
src/browser/popup/styles/_popup.styl
Normal file
59
src/browser/popup/styles/_popup.styl
Normal file
@@ -0,0 +1,59 @@
|
||||
.popup-body
|
||||
.search-block
|
||||
padding: 5px
|
||||
height:44px
|
||||
position:absolute
|
||||
top: 0
|
||||
width: 100%
|
||||
|
||||
.result-block
|
||||
position:absolute
|
||||
top: 44px
|
||||
bottom: 0
|
||||
width: 100%
|
||||
overflow: hidden
|
||||
.left-pane
|
||||
margin: 0
|
||||
position: absolute
|
||||
left: 0
|
||||
top: 0
|
||||
bottom: 0
|
||||
width: 40%
|
||||
overflow-y: auto
|
||||
overflow-x: hidden
|
||||
.result-list
|
||||
list-style:none
|
||||
padding: 0
|
||||
border-right: 1px solid $baseBorderColor
|
||||
li
|
||||
&:nth-child(even)
|
||||
background-color $baseBackgroundColor
|
||||
&:nth-child(odd)
|
||||
background-color lighten($baseBackgroundColor, 2%)
|
||||
&.active
|
||||
color: $textColorSelected
|
||||
background-color: $btnPrimary
|
||||
a
|
||||
display:block
|
||||
padding: 5px 10px
|
||||
border-bottom 1px solid $baseBorderColor
|
||||
|
||||
.right-pane
|
||||
position: absolute
|
||||
left: 40%
|
||||
top: 0
|
||||
bottom: 0
|
||||
width: 60%
|
||||
overflow-y: auto
|
||||
overflow-x: hidden
|
||||
.result-detail-control
|
||||
position: absolute
|
||||
top: 0
|
||||
width: 100%
|
||||
height: 34px
|
||||
|
||||
.result-detail-content
|
||||
position: absolute
|
||||
top: 34px
|
||||
bottom: 0
|
||||
width: 100%
|
||||
4
src/browser/popup/styles/main.styl
Normal file
4
src/browser/popup/styles/main.styl
Normal file
@@ -0,0 +1,4 @@
|
||||
@import '../../shared/styles/_vars'
|
||||
@import '../../shared/styles/mixins/*'
|
||||
|
||||
@import '_popup'
|
||||
@@ -1,3 +1,3 @@
|
||||
/* global angular */
|
||||
angular.module('codexen')
|
||||
angular.module('codexen.shared')
|
||||
.constant('aceModes', ['ABAP', 'ABC', 'ActionScript', 'ADA', 'Apache_Conf', 'AsciiDoc', 'Assembly_x86', 'AutoHotKey', 'BatchFile', 'C9Search', 'C_Cpp', 'Cirru', 'Clojure', 'Cobol', 'coffee', 'ColdFusion', 'CSharp', 'CSS', 'Curly', 'D', 'Dart', 'Diff', 'Dockerfile', 'Dot', 'Dummy', 'DummySyntax', 'Eiffel', 'EJS', 'Elixir', 'Elm', 'Erlang', 'Forth', 'FTL', 'Gcode', 'Gherkin', 'Gitignore', 'Glsl', 'golang', 'Groovy', 'HAML', 'Handlebars', 'Haskell', 'haXe', 'HTML', 'HTML_Ruby', 'INI', 'Io', 'Jack', 'Jade', 'Java', 'JavaScript', 'JSON', 'JSONiq', 'JSP', 'JSX', 'Julia', 'LaTeX', 'Lean', 'LESS', 'Liquid', 'Lisp', 'LiveScript', 'LogiQL', 'LSL', 'Lua', 'LuaPage', 'Lucene', 'Makefile', 'Markdown', 'Mask', 'MATLAB', 'MEL', 'MUSHCode', 'MySQL', 'Nix', 'ObjectiveC', 'OCaml', 'Pascal', 'Perl', 'pgSQL', 'PHP', 'Powershell', 'Praat', 'Prolog', 'Properties', 'Protobuf', 'Python', 'R', 'RDoc', 'RHTML', 'Ruby', 'Rust', 'SASS', 'SCAD', 'Scala', 'Scheme', 'SCSS', 'SH', 'SJS', 'Smarty', 'snippets', 'Soy_Template', 'Space', 'SQL', 'SQLServer', 'Stylus', 'SVG', 'Tcl', 'Tex', 'Text', 'Textile', 'Toml', 'Twig', 'Typescript', 'Vala', 'VBScript', 'Velocity', 'Verilog', 'VHDL', 'XML', 'XQuery', 'YAML', 'Django'])
|
||||
4
src/browser/shared/config/env.js
Normal file
4
src/browser/shared/config/env.js
Normal file
@@ -0,0 +1,4 @@
|
||||
/* global angular */
|
||||
angular.module('codexen.shared')
|
||||
.constant('apiUrl', 'http://localhost:8000/')
|
||||
// .constant('apiUrl', 'http://codexen-server-dev.elasticbeanstalk.com/')
|
||||
@@ -1,6 +1,6 @@
|
||||
/* global angular */
|
||||
angular.module('codexen')
|
||||
.config(function ($authProvider, $httpProvider, apiUrl) {
|
||||
angular.module('codexen.shared')
|
||||
.config(function ($authProvider, $httpProvider, apiUrl, appName) {
|
||||
$authProvider.baseUrl = apiUrl
|
||||
|
||||
$httpProvider.defaults.useXDomain = true
|
||||
@@ -10,8 +10,15 @@ angular.module('codexen')
|
||||
responseError: function (res) {
|
||||
switch (res.status) {
|
||||
case 401:
|
||||
var $state = $injector.get('$state')
|
||||
$state.go('auth.signin')
|
||||
switch (appName) {
|
||||
case 'main' :
|
||||
var $state = $injector.get('$state')
|
||||
$state.go('auth.signin')
|
||||
break
|
||||
case 'popup' :
|
||||
// TODO: hide popup
|
||||
break
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
52
src/browser/shared/services/Snippet.js
Normal file
52
src/browser/shared/services/Snippet.js
Normal file
@@ -0,0 +1,52 @@
|
||||
/* global angular */
|
||||
angular.module('codexen.shared')
|
||||
.factory('Snippet', function ($http, $auth, apiUrl) {
|
||||
var findByUser = function (user) {
|
||||
var url = apiUrl + 'snippets/search'
|
||||
|
||||
return $http.get(url, {
|
||||
params: {
|
||||
user: user
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
var findMine = function (params) {
|
||||
var url = apiUrl + 'snippets/my'
|
||||
|
||||
return $http.get(url, {params: params})
|
||||
}
|
||||
|
||||
var create = function (params) {
|
||||
var url = apiUrl + 'snippets/create'
|
||||
|
||||
return $http.post(url, params)
|
||||
}
|
||||
|
||||
var show = function (id, params) {
|
||||
var url = apiUrl + 'snippets/id/' + id
|
||||
|
||||
return $http.get(url, {params: params})
|
||||
}
|
||||
|
||||
var update = function (id, params) {
|
||||
var url = apiUrl + 'snippets/id/' + id
|
||||
|
||||
return $http.put(url, params)
|
||||
}
|
||||
|
||||
var destroy = function (id) {
|
||||
var url = apiUrl + 'snippets/id/' + id
|
||||
|
||||
return $http.delete(url)
|
||||
}
|
||||
|
||||
return {
|
||||
findByUser: findByUser,
|
||||
findMine: findMine,
|
||||
create: create,
|
||||
show: show,
|
||||
delete: destroy,
|
||||
update: update
|
||||
}
|
||||
})
|
||||
3
src/browser/shared/shared.js
Normal file
3
src/browser/shared/shared.js
Normal file
@@ -0,0 +1,3 @@
|
||||
angular.module('codexen.shared', [
|
||||
'satellizer'
|
||||
])
|
||||
24
src/browser/shared/styles/_index.styl
Normal file
24
src/browser/shared/styles/_index.styl
Normal file
@@ -0,0 +1,24 @@
|
||||
html
|
||||
overflow: hidden
|
||||
height: 100%
|
||||
|
||||
body
|
||||
height: 100%
|
||||
overflow: auto
|
||||
font-family: "Lato", sans-serif
|
||||
color $textColor
|
||||
background-color: $appBackgroundColor
|
||||
|
||||
label
|
||||
font-family: "Lato", sans-serif
|
||||
color $textColor
|
||||
|
||||
h1, h2, h3, h4, h5
|
||||
color $textColorHighlight
|
||||
margin 0
|
||||
|
||||
textarea
|
||||
resize: vertical
|
||||
|
||||
hr
|
||||
border-color $baseBorderColor
|
||||
5639
src/browser/shared/styles/bootstrap.css
vendored
Normal file
5639
src/browser/shared/styles/bootstrap.css
vendored
Normal file
File diff suppressed because it is too large
Load Diff
57
src/browser/shared/styles/bootstrap.styl
vendored
Normal file
57
src/browser/shared/styles/bootstrap.styl
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
// Override vars and mixins
|
||||
@import '_vars'
|
||||
@import 'mixins/*'
|
||||
|
||||
// Core variables and mixins
|
||||
@import '../../../../node_modules/bootstrap-styl/bootstrap/variables'
|
||||
@import '../../../../node_modules/bootstrap-styl/bootstrap/mixins'
|
||||
|
||||
// Utilities
|
||||
@import '../../../../node_modules/bootstrap-styl/bootstrap/utilities'
|
||||
@import '../../../../node_modules/bootstrap-styl/bootstrap/responsive-utilities'
|
||||
|
||||
// Reset and dependencies
|
||||
@import '../../../../node_modules/bootstrap-styl/bootstrap/normalize'
|
||||
@import '../../../../node_modules/bootstrap-styl/bootstrap/print'
|
||||
|
||||
// Core CSS
|
||||
@import '../../../../node_modules/bootstrap-styl/bootstrap/scaffolding'
|
||||
@import '../../../../node_modules/bootstrap-styl/bootstrap/type'
|
||||
// @import '../../../../node_modules/bootstrap-styl/bootstrap/code'
|
||||
@import '../../../../node_modules/bootstrap-styl/bootstrap/grid'
|
||||
@import '../../../../node_modules/bootstrap-styl/bootstrap/tables'
|
||||
@import '../../../../node_modules/bootstrap-styl/bootstrap/forms'
|
||||
@import '../../../../node_modules/bootstrap-styl/bootstrap/buttons'
|
||||
|
||||
// Components
|
||||
@import '../../../../node_modules/bootstrap-styl/bootstrap/component-animations'
|
||||
@import '../../../../node_modules/bootstrap-styl/bootstrap/dropdowns'
|
||||
@import '../../../../node_modules/bootstrap-styl/bootstrap/button-groups'
|
||||
@import '../../../../node_modules/bootstrap-styl/bootstrap/input-groups'
|
||||
@import '../../../../node_modules/bootstrap-styl/bootstrap/navs'
|
||||
@import '../../../../node_modules/bootstrap-styl/bootstrap/navbar'
|
||||
// @import '../../../../node_modules/bootstrap-styl/bootstrap/breadcrumbs'
|
||||
// @import '../../../../node_modules/bootstrap-styl/bootstrap/pagination'
|
||||
// @import '../../../../node_modules/bootstrap-styl/bootstrap/pager'
|
||||
@import '../../../../node_modules/bootstrap-styl/bootstrap/labels'
|
||||
@import '../../../../node_modules/bootstrap-styl/bootstrap/badges'
|
||||
@import '../../../../node_modules/bootstrap-styl/bootstrap/jumbotron'
|
||||
@import '../../../../node_modules/bootstrap-styl/bootstrap/thumbnails'
|
||||
@import '../../../../node_modules/bootstrap-styl/bootstrap/alerts'
|
||||
@import '../../../../node_modules/bootstrap-styl/bootstrap/progress-bars'
|
||||
@import '../../../../node_modules/bootstrap-styl/bootstrap/media'
|
||||
@import '../../../../node_modules/bootstrap-styl/bootstrap/list-group'
|
||||
@import '../../../../node_modules/bootstrap-styl/bootstrap/panels'
|
||||
@import '../../../../node_modules/bootstrap-styl/bootstrap/responsive-embed'
|
||||
@import '../../../../node_modules/bootstrap-styl/bootstrap/wells'
|
||||
@import '../../../../node_modules/bootstrap-styl/bootstrap/close'
|
||||
|
||||
// Components w/ JavaScript
|
||||
@import '../../../../node_modules/bootstrap-styl/bootstrap/modals'
|
||||
@import '../../../../node_modules/bootstrap-styl/bootstrap/tooltip'
|
||||
@import '../../../../node_modules/bootstrap-styl/bootstrap/popovers'
|
||||
// @import '../../../../node_modules/bootstrap-styl/bootstrap/carousel'
|
||||
|
||||
// Overrides
|
||||
@import '_shared'
|
||||
@import '_index'
|
||||
@@ -1,63 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html ng-app="codexen">
|
||||
<head>
|
||||
<title>
|
||||
CodeXen App
|
||||
</title>
|
||||
|
||||
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/>
|
||||
<meta name="description" content="CodeXen - Short code storage service">
|
||||
|
||||
<title>Codexen!</title>
|
||||
|
||||
|
||||
<% if(env === 'dist') { %>
|
||||
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
|
||||
<% } %>
|
||||
|
||||
<% if(env === 'build') { %>
|
||||
<link rel="stylesheet" href="vendor/css/font-awesome.css" media="screen" title="no title" charset="utf-8">
|
||||
<% } %>
|
||||
|
||||
<% styles.forEach(function(style){ %>
|
||||
<link rel="stylesheet" href="<%=style %>" media="screen" title="no title" charset="utf-8">
|
||||
<% }) %>
|
||||
|
||||
|
||||
</head>
|
||||
<body ng-controller="AppController as app">
|
||||
<div side-nav id="side-view"></div>
|
||||
<div ui-view name="main-view" id="main-view"></div>
|
||||
|
||||
<% if(env === 'dist') { %>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.1.9/ace.js" charset="utf-8"></script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js" charset="utf-8"></script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular-sanitize.min.js" charset="utf-8"></script>
|
||||
<script src="https://cdn.rawgit.com/angular-ui/ui-router/0.2.15/release/angular-ui-router.min.js" charset="utf-8"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.13.0/ui-bootstrap-tpls.min.js" charset="utf-8"></script>
|
||||
<script src="https://cdn.rawgit.com/angular-ui/ui-select/v0.12.0/dist/select.min.js" charset="utf-8"></script>
|
||||
<script src="https://cdn.jsdelivr.net/satellizer/0.11.2/satellizer.min.js"></script>
|
||||
<script src="https://cdn.rawgit.com/gdi2290/angular-md5/v0.1.7/angular-md5.min.js" charset="utf-8"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.3/moment.min.js" charset="utf-8"></script>
|
||||
<% } %>
|
||||
|
||||
<% if(env === 'build') { %>
|
||||
<script src="vendor/ace.js"></script>
|
||||
<script src="vendor/angular.js"></script>
|
||||
<script src="vendor/angular-sanitize.js"></script>
|
||||
<script src="vendor/angular-ui-router.js"></script>
|
||||
<script src="vendor/ui-bootstrap-tpls.js"></script>
|
||||
<script src="vendor/select.js"></script>
|
||||
<script src="vendor/satellizer.js"></script>
|
||||
<script src="vendor/angular-md5.js"></script>
|
||||
<script src="vendor/moment.js"></script>
|
||||
<% } %>
|
||||
|
||||
|
||||
<% scripts.forEach(function(script){ %>
|
||||
<script src="<%=script %>"></script>
|
||||
<% }) %>
|
||||
</body>
|
||||
</html>
|
||||
249
src/main.js
Normal file
249
src/main.js
Normal file
@@ -0,0 +1,249 @@
|
||||
var app = require('app') // Module to control application life.
|
||||
var BrowserWindow = require('browser-window') // Module to create native browser window.
|
||||
|
||||
// Report crashes to our server.
|
||||
require('crash-reporter').start()
|
||||
|
||||
// Keep a global reference of the window object, if you don't, the window will
|
||||
// be closed automatically when the javascript object is GCed.
|
||||
var mainWindow = null
|
||||
|
||||
// app.on('window-all-closed', function () {
|
||||
// if (process.platform !== 'darwin') app.quit()
|
||||
// })
|
||||
|
||||
var clipboard = require('clipboard')
|
||||
var Tray = require('tray')
|
||||
var notifier = require('node-notifier')
|
||||
|
||||
var appIcon = null
|
||||
|
||||
app.on('ready', function () {
|
||||
appIcon = new Tray(__dirname + '/tray-icon.png')
|
||||
appIcon.setToolTip('This is my application.')
|
||||
appIcon.on('clicked', function () {
|
||||
if (mainWindow == null) {
|
||||
makeNewMainWindow()
|
||||
}
|
||||
mainWindow.show()
|
||||
})
|
||||
|
||||
makeNewMainWindow()
|
||||
|
||||
var globalShortcut = require('global-shortcut')
|
||||
|
||||
var popUpWindow = new BrowserWindow({
|
||||
width: 600,
|
||||
height: 400,
|
||||
show: false,
|
||||
frame: false,
|
||||
'web-preferences': {
|
||||
'overlay-scrollbars': true,
|
||||
'skip-taskbar': true
|
||||
}
|
||||
})
|
||||
|
||||
popUpWindow.loadUrl('file://' + __dirname + '/browser/popup/index.html')
|
||||
|
||||
app.on('activate-with-no-open-windows', function () {
|
||||
if (mainWindow == null) {
|
||||
makeNewMainWindow()
|
||||
}
|
||||
mainWindow.show()
|
||||
})
|
||||
|
||||
popUpWindow.on('blur', function () {
|
||||
popUpWindow.hide()
|
||||
})
|
||||
popUpWindow.setVisibleOnAllWorkspaces(true)
|
||||
|
||||
var hidePopUp = function () {
|
||||
if (fromMain) {
|
||||
|
||||
} else {
|
||||
mainWindow ? mainWindow.hide() : null
|
||||
Menu.sendActionToFirstResponder('hide:')
|
||||
}
|
||||
|
||||
popUpWindow.hide()
|
||||
}
|
||||
|
||||
var ipc = require('ipc')
|
||||
ipc.on('hidePopUp', function () {
|
||||
hidePopUp()
|
||||
})
|
||||
|
||||
ipc.on('writeCode', function (e, code) {
|
||||
clipboard.writeText(code)
|
||||
notifier.notify({
|
||||
title: 'Write on clipboard!',
|
||||
message: 'Ready to paste',
|
||||
wait: false
|
||||
}, function (err, res) {
|
||||
|
||||
})
|
||||
hidePopUp()
|
||||
})
|
||||
|
||||
var fromMain
|
||||
// Register a 'ctrl+x' shortcut listener.
|
||||
var ret = globalShortcut.register('ctrl+tab+shift', function () {
|
||||
if (popUpWindow.isVisible()) {
|
||||
hidePopUp()
|
||||
return
|
||||
}
|
||||
fromMain = mainWindow ? mainWindow.isFocused() : false
|
||||
popUpWindow.show()
|
||||
|
||||
})
|
||||
if (!ret) console.log('registerion fails')
|
||||
|
||||
// MENU
|
||||
var Menu = require('menu')
|
||||
var template = [
|
||||
{
|
||||
label: 'Electron',
|
||||
submenu: [
|
||||
{
|
||||
label: 'About Electron',
|
||||
selector: 'orderFrontStandardAboutPanel:'
|
||||
},
|
||||
{
|
||||
type: 'separator'
|
||||
},
|
||||
{
|
||||
label: 'Services',
|
||||
submenu: []
|
||||
},
|
||||
{
|
||||
type: 'separator'
|
||||
},
|
||||
{
|
||||
label: 'Hide Electron',
|
||||
accelerator: 'Command+H',
|
||||
selector: 'hide:'
|
||||
},
|
||||
{
|
||||
label: 'Hide Others',
|
||||
accelerator: 'Command+Shift+H',
|
||||
selector: 'hideOtherApplications:'
|
||||
},
|
||||
{
|
||||
label: 'Show All',
|
||||
selector: 'unhideAllApplications:'
|
||||
},
|
||||
{
|
||||
type: 'separator'
|
||||
},
|
||||
{
|
||||
label: 'Quit',
|
||||
accelerator: 'Command+Q',
|
||||
click: function () { app.quit() }
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Edit',
|
||||
submenu: [
|
||||
{
|
||||
label: 'Undo',
|
||||
accelerator: 'Command+Z',
|
||||
selector: 'undo:'
|
||||
},
|
||||
{
|
||||
label: 'Redo',
|
||||
accelerator: 'Shift+Command+Z',
|
||||
selector: 'redo:'
|
||||
},
|
||||
{
|
||||
type: 'separator'
|
||||
},
|
||||
{
|
||||
label: 'Cut',
|
||||
accelerator: 'Command+X',
|
||||
selector: 'cut:'
|
||||
},
|
||||
{
|
||||
label: 'Copy',
|
||||
accelerator: 'Command+C',
|
||||
selector: 'copy:'
|
||||
},
|
||||
{
|
||||
label: 'Paste',
|
||||
accelerator: 'Command+V',
|
||||
selector: 'paste:'
|
||||
},
|
||||
{
|
||||
label: 'Select All',
|
||||
accelerator: 'Command+A',
|
||||
selector: 'selectAll:'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'View',
|
||||
submenu: [
|
||||
{
|
||||
label: 'Reload',
|
||||
accelerator: 'Command+R',
|
||||
click: function () { BrowserWindow.getFocusedWindow().reloadIgnoringCache() }
|
||||
},
|
||||
{
|
||||
label: 'Toggle DevTools',
|
||||
accelerator: 'Alt+Command+I',
|
||||
click: function () { BrowserWindow.getFocusedWindow().toggleDevTools() }
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Window',
|
||||
submenu: [
|
||||
{
|
||||
label: 'Minimize',
|
||||
accelerator: 'Command+M',
|
||||
selector: 'performMiniaturize:'
|
||||
},
|
||||
{
|
||||
label: 'Close',
|
||||
accelerator: 'Command+W',
|
||||
selector: 'performClose:'
|
||||
},
|
||||
{
|
||||
type: 'separator'
|
||||
},
|
||||
{
|
||||
label: 'Bring All to Front',
|
||||
selector: 'arrangeInFront:'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Help',
|
||||
submenu: []
|
||||
}
|
||||
]
|
||||
|
||||
var menu = Menu.buildFromTemplate(template)
|
||||
|
||||
Menu.setApplicationMenu(menu)
|
||||
|
||||
function makeNewMainWindow () {
|
||||
console.log('new Window!')
|
||||
mainWindow = new BrowserWindow({
|
||||
width: 920,
|
||||
height: 640,
|
||||
'web-preferences': {
|
||||
'overlay-scrollbars': true
|
||||
}
|
||||
})
|
||||
|
||||
mainWindow.loadUrl('file://' + __dirname + '/browser/main/index.html')
|
||||
|
||||
mainWindow.on('closed', function () {
|
||||
console.log('main closed')
|
||||
mainWindow = null
|
||||
app.dock.hide()
|
||||
})
|
||||
app.dock.show()
|
||||
}
|
||||
})
|
||||
32
src/package.json
Normal file
32
src/package.json
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "codexen-app",
|
||||
"version": "0.2.0",
|
||||
"description": "CodeXen App",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [
|
||||
"codexen",
|
||||
"snippet",
|
||||
"template",
|
||||
"task",
|
||||
"runner",
|
||||
"remote",
|
||||
"automator",
|
||||
"code",
|
||||
"storage",
|
||||
"short code"
|
||||
],
|
||||
"author": "Dick Choi <fluke8259@gmail.com> (http://kazup.co)",
|
||||
"license": "No License",
|
||||
"bugs": {
|
||||
"url": "https://github.com/Rokt33r/codexen-app/issues"
|
||||
},
|
||||
"homepage": "https://codexen.github.io",
|
||||
"dependencies": {
|
||||
"dotenv": "^1.1.0",
|
||||
"robotjs": "^0.1.2",
|
||||
"node-notifier": "^4.2.1"
|
||||
},
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
// Core variables and mixins
|
||||
@import '../../node_modules/bootstrap-styl/bootstrap/variables'
|
||||
@import '../../node_modules/bootstrap-styl/bootstrap/mixins'
|
||||
|
||||
// Utilities
|
||||
@import '../../node_modules/bootstrap-styl/bootstrap/utilities'
|
||||
@import '../../node_modules/bootstrap-styl/bootstrap/responsive-utilities'
|
||||
|
||||
// Reset and dependencies
|
||||
@import '../../node_modules/bootstrap-styl/bootstrap/normalize'
|
||||
@import '../../node_modules/bootstrap-styl/bootstrap/print'
|
||||
|
||||
// Core CSS
|
||||
@import '../../node_modules/bootstrap-styl/bootstrap/scaffolding'
|
||||
@import '../../node_modules/bootstrap-styl/bootstrap/type'
|
||||
// @import '../../node_modules/bootstrap-styl/bootstrap/code'
|
||||
@import '../../node_modules/bootstrap-styl/bootstrap/grid'
|
||||
@import '../../node_modules/bootstrap-styl/bootstrap/tables'
|
||||
@import '../../node_modules/bootstrap-styl/bootstrap/forms'
|
||||
@import '../../node_modules/bootstrap-styl/bootstrap/buttons'
|
||||
|
||||
// Components
|
||||
@import '../../node_modules/bootstrap-styl/bootstrap/component-animations'
|
||||
@import '../../node_modules/bootstrap-styl/bootstrap/dropdowns'
|
||||
@import '../../node_modules/bootstrap-styl/bootstrap/button-groups'
|
||||
@import '../../node_modules/bootstrap-styl/bootstrap/input-groups'
|
||||
@import '../../node_modules/bootstrap-styl/bootstrap/navs'
|
||||
@import '../../node_modules/bootstrap-styl/bootstrap/navbar'
|
||||
// @import '../../node_modules/bootstrap-styl/bootstrap/breadcrumbs'
|
||||
// @import '../../node_modules/bootstrap-styl/bootstrap/pagination'
|
||||
// @import '../../node_modules/bootstrap-styl/bootstrap/pager'
|
||||
@import '../../node_modules/bootstrap-styl/bootstrap/labels'
|
||||
@import '../../node_modules/bootstrap-styl/bootstrap/badges'
|
||||
@import '../../node_modules/bootstrap-styl/bootstrap/jumbotron'
|
||||
@import '../../node_modules/bootstrap-styl/bootstrap/thumbnails'
|
||||
@import '../../node_modules/bootstrap-styl/bootstrap/alerts'
|
||||
@import '../../node_modules/bootstrap-styl/bootstrap/progress-bars'
|
||||
@import '../../node_modules/bootstrap-styl/bootstrap/media'
|
||||
@import '../../node_modules/bootstrap-styl/bootstrap/list-group'
|
||||
@import '../../node_modules/bootstrap-styl/bootstrap/panels'
|
||||
@import '../../node_modules/bootstrap-styl/bootstrap/responsive-embed'
|
||||
@import '../../node_modules/bootstrap-styl/bootstrap/wells'
|
||||
@import '../../node_modules/bootstrap-styl/bootstrap/close'
|
||||
|
||||
// Components w/ JavaScript
|
||||
@import '../../node_modules/bootstrap-styl/bootstrap/modals'
|
||||
@import '../../node_modules/bootstrap-styl/bootstrap/tooltip'
|
||||
@import '../../node_modules/bootstrap-styl/bootstrap/popovers'
|
||||
// @import '../../node_modules/bootstrap-styl/bootstrap/carousel'
|
||||
@@ -1,11 +0,0 @@
|
||||
@import '_vars'
|
||||
@import 'mixins/*'
|
||||
|
||||
@import '_bootstrap'
|
||||
|
||||
@import '_index'
|
||||
@import '_shared'
|
||||
|
||||
@import 'modals/*'
|
||||
@import 'directives/*'
|
||||
@import 'states/*'
|
||||
BIN
src/tray-icon.png
Normal file
BIN
src/tray-icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 542 B |
Reference in New Issue
Block a user