1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-19 12:41:43 +00:00

add authentication check for popup & add notification(clipboarded)

This commit is contained in:
Rokt33r
2015-06-15 15:47:24 +09:00
parent 6aa32d49fc
commit a3ae5f02dd
7 changed files with 34 additions and 35 deletions

View File

@@ -11,14 +11,9 @@ angular.module('codexen.popup', [
'cfp.hotkeys'
])
.controller('PopUpController', function ($scope, Snippet, $auth, $window, hotkeys, $document, $filter) {
// For Dev
$scope.toggleDev = function () {
remote.getCurrentWindow().toggleDevTools()
}
// Setup Events
remote.getCurrentWindow().on('focus', function () {
if (!$auth.isAuthenticated()) return hidePopUp()
$scope.$apply(focusSearchInput)
loadSnippets()
})
@@ -48,8 +43,7 @@ angular.module('codexen.popup', [
e.preventDefault()
})
.add('enter', function (e) {
console.log($scope.selectedItem.content)
ipc.send('writeCode', $scope.selectedItem.content)
writeCode($scope.selectedItem.content)
e.preventDefault()
})
@@ -95,6 +89,7 @@ angular.module('codexen.popup', [
$scope.selectSnippet = selectSnippet
$scope.filterList = filterList
$scope.writeCode = writeCode
$scope.focusSearchInput = focusSearchInput
// Search Filter
@@ -143,6 +138,10 @@ angular.module('codexen.popup', [
selectSnippet()
}
function writeCode (code) {
ipc.send('writeCode', code)
}
// Focusing Search Input
function focusSearchInput () {
document.getElementById('search-input').focus()