Skip to content

Commit 679dbdd

Browse files
author
manickampr
committed
first commit
0 parents  commit 679dbdd

27 files changed

+2374
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.DS_Store
2+
npm-debug.log
3+
node_modules

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## 0.1.0 - First Release
2+
* Every feature added
3+
* Every bug fixed

LICENSE.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright (c) 2014 <Your name here>
2+
3+
Permission is hereby granted, free of charge, to any person obtaining
4+
a copy of this software and associated documentation files (the
5+
"Software"), to deal in the Software without restriction, including
6+
without limitation the rights to use, copy, modify, merge, publish,
7+
distribute, sublicense, and/or sell copies of the Software, and to
8+
permit persons to whom the Software is furnished to do so, subject to
9+
the following conditions:
10+
11+
The above copyright notice and this permission notice shall be
12+
included in all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# browser-plus package
2+
3+
A short description of your package.
4+
5+
![A screenshot of your package](https://f.cloud.github.com/assets/69169/2290250/c35d867a-a017-11e3-86be-cd7c5bf3ff9b.gif)

keymaps/browser-plus.cson

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Keybindings require three things to be fully defined: A selector that is
2+
# matched against the focused element, the keystroke and the command to
3+
# execute.
4+
#
5+
# Below is a basic keybinding which registers on all platforms by applying to
6+
# the root workspace element.
7+
8+
# For more detailed documentation see
9+
# https://atom.io/docs/latest/advanced/keymaps
10+
'atom-workspace':
11+
'ctrl-alt-o': 'browser-plus:open',
12+
'ctrl-alt-h': 'browser-plus:history'
13+
14+
'.browser-plus webview':
15+
'tab': 'native!'
16+
'shift-tab': 'native!'
17+
# 'backspace': 'native!'
18+
# 'left': 'native!'
19+
# 'up': 'native!'
20+
# 'down': 'native!'
21+
# 'right': 'native!'
22+
'pagedown': 'native!'
23+
'pageup': 'native!'
24+
# 'shift-left': 'native!'
25+
# 'shift-right': 'native!'
26+
# 'delete': 'native!'
27+
'f12': 'browser-plus:openDevTool'

lib/browser-plus-model.coffee

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{Disposable,Emitter,$, $$,$$$} = require 'atom'
2+
{Model} = require 'theorist'
3+
# {CompositeDisposable, Emitter} = require 'event-kit'
4+
path = require 'path'
5+
module.exports =
6+
class HTMLEditor extends Model
7+
constructor: (@browserPlus,@uri,@src)->
8+
@disposable = new Disposable()
9+
@emitter = new Emitter
10+
11+
getViewClass: ->
12+
require './browser-plus-view'
13+
14+
setText: (text)->
15+
@view.setSrc(text)
16+
17+
destroyed: ->
18+
# @unsubscribe()
19+
@emitter.emit 'did-destroy'
20+
onDidDestroy: (cb)->
21+
@emitter.on 'did-destroy', cb
22+
23+
getTitle: ->
24+
@title or path.basename(@uri)
25+
26+
getUri: ->
27+
if @src?.includes('data:text/html,')
28+
# regex = new RegExp("<bp-uri>([\\s\\S]*?)</bp-uri>")
29+
regex = /<meta\s?\S*?\s?bp-uri=['"](.*?)['"]\S*\/>/
30+
match = @src.match(regex)
31+
if match?[1]
32+
@uri = "browser-plus://preview~#{match[1]}"
33+
else
34+
@uri = "browser-plus://preview~#{new Date().getTime()}.html"
35+
else
36+
@uri
37+
38+
getGrammar: ->
39+
40+
setTitle: (@title)->
41+
@emit 'title-changed'

0 commit comments

Comments
 (0)