master
parent
384387548e
commit
8b847dc2fb
|
@ -344,6 +344,7 @@ section.main aside.main nav.footer ul {
|
||||||
}
|
}
|
||||||
section.main aside.main nav.footer ul li {
|
section.main aside.main nav.footer ul li {
|
||||||
background: transparent url('https://snipt.s3.amazonaws.com/images/api-icon.png') center left no-repeat;
|
background: transparent url('https://snipt.s3.amazonaws.com/images/api-icon.png') center left no-repeat;
|
||||||
|
list-style-type: none;
|
||||||
margin: 6px 0 6px 0;
|
margin: 6px 0 6px 0;
|
||||||
padding-left: 22px;
|
padding-left: 22px;
|
||||||
}
|
}
|
||||||
|
@ -685,6 +686,11 @@ article.snipt.selected div.container {
|
||||||
article.snipt.selected div.container:after {
|
article.snipt.selected div.container:after {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
article.snipt div.copy-modal textarea {
|
||||||
|
height: 200px;
|
||||||
|
margin: 0;
|
||||||
|
width: 520px;
|
||||||
|
}
|
||||||
article.private-snipt div.container header {
|
article.private-snipt div.container header {
|
||||||
background: #fffdf9 url('https://snipt.s3.amazonaws.com/images/private-icon.png') top right no-repeat;
|
background: #fffdf9 url('https://snipt.s3.amazonaws.com/images/private-icon.png') top right no-repeat;
|
||||||
background: url('https://snipt.s3.amazonaws.com/images/private-icon.png') top right no-repeat, -webkit-gradient(linear, left top, left bottom, from(#ffffff), to(#fffaf2));
|
background: url('https://snipt.s3.amazonaws.com/images/private-icon.png') top right no-repeat, -webkit-gradient(linear, left top, left bottom, from(#ffffff), to(#fffaf2));
|
||||||
|
@ -704,6 +710,27 @@ div.pagination ul {
|
||||||
div.pagination ul li a {
|
div.pagination ul li a {
|
||||||
color: #3BAAF3;
|
color: #3BAAF3;
|
||||||
}
|
}
|
||||||
|
div.modal .modal-header .close {
|
||||||
|
line-height: 20px;
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
div.modal .modal-header h3 span {
|
||||||
|
display: inline-block;
|
||||||
|
max-width: 400px;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
div.modal .modal-header h4 {
|
||||||
|
color: #AAA;
|
||||||
|
margin-top: 1px;
|
||||||
|
}
|
||||||
|
div#keyboard-shortcuts {
|
||||||
|
max-height: 501px;
|
||||||
|
}
|
||||||
|
div#keyboard-shortcuts table {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
body.detail div.right-y {
|
body.detail div.right-y {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
|
@ -921,7 +921,7 @@ var snipt = {
|
||||||
jQuery(function($) {
|
jQuery(function($) {
|
||||||
|
|
||||||
var SiteView = snipt.module('site').Views.SiteView;
|
var SiteView = snipt.module('site').Views.SiteView;
|
||||||
var Site = new SiteView();
|
window.site = new SiteView();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -937,6 +937,7 @@ jQuery(function($) {
|
||||||
this.$el = $(this.el);
|
this.$el = $(this.el);
|
||||||
this.$search_query = $('input#search-query', this.$el);
|
this.$search_query = $('input#search-query', this.$el);
|
||||||
this.$snipts = $('section#snipts article.snipt', this.$el);
|
this.$snipts = $('section#snipts article.snipt', this.$el);
|
||||||
|
this.$copyModals = $('div.copy-modal', this.$snipts);
|
||||||
|
|
||||||
this.keyboardShortcuts();
|
this.keyboardShortcuts();
|
||||||
this.inFieldLabels();
|
this.inFieldLabels();
|
||||||
|
@ -971,21 +972,20 @@ jQuery(function($) {
|
||||||
$search_query = this.$search_query;
|
$search_query = this.$search_query;
|
||||||
$document = $(document);
|
$document = $(document);
|
||||||
|
|
||||||
// Search
|
|
||||||
$document.bind('keydown', '/', function(e) {
|
$document.bind('keydown', '/', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
$search_query.focus();
|
$search_query.focus();
|
||||||
});
|
});
|
||||||
|
|
||||||
$document.bind('keydown', 'Shift+/', function(e) {
|
$document.bind('keydown', 'Shift+/', function(e) {
|
||||||
$el.trigger('showKeyboardShortcuts');
|
$el.trigger('showKeyboardShortcuts');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Escape
|
|
||||||
$('input').bind('keydown', 'esc', function(e) {
|
$('input').bind('keydown', 'esc', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
this.blur();
|
this.blur();
|
||||||
});
|
});
|
||||||
|
$document.bind('keydown', 'Shift+h', function(e) {
|
||||||
|
history.go(-1);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
showKeyboardShortcuts: function() {
|
showKeyboardShortcuts: function() {
|
||||||
$('#keyboard-shortcuts').modal('toggle');
|
$('#keyboard-shortcuts').modal('toggle');
|
||||||
|
@ -1022,37 +1022,68 @@ jQuery(function($) {
|
||||||
|
|
||||||
this.$aside = $('aside', this.$el);
|
this.$aside = $('aside', this.$el);
|
||||||
this.$container = $('div.container', this.$el);
|
this.$container = $('div.container', this.$el);
|
||||||
this.$raw = $('div.raw', this.$container);
|
this.$copyModal = $('div.copy-modal', this.$el);
|
||||||
|
this.$copyModalBody = $('div.modal-body', this.$copyModal);
|
||||||
|
this.$copyModalClose = $('a.close', this.$copyModal);
|
||||||
|
this.$copyModalType = $('h4 span', this.$copyModal);
|
||||||
|
this.$raw = $('div.raw', this.$el);
|
||||||
this.$tags = $('section.tags ul', this.$aside);
|
this.$tags = $('section.tags ul', this.$aside);
|
||||||
|
|
||||||
|
this.$copyModal.on('hidden', function(e) {
|
||||||
|
$(this).parent().trigger('copyClose');
|
||||||
|
});
|
||||||
|
this.$copyModalClose.click(function() {
|
||||||
|
$(this).parent().parent().modal('hide');
|
||||||
|
return false;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
events: {
|
events: {
|
||||||
'click a.copy': 'copy',
|
'click a.copy': 'copyFromClick',
|
||||||
|
'click a.embed': 'embed',
|
||||||
'click a.expand': 'expand',
|
'click a.expand': 'expand',
|
||||||
'click .container': 'selectFromClick',
|
'click .container': 'selectFromClick',
|
||||||
'copy': 'copy',
|
'copy': 'copy',
|
||||||
|
'copyClose': 'copyClose',
|
||||||
'detail': 'detail',
|
'detail': 'detail',
|
||||||
'deselect': 'deselect',
|
'deselect': 'deselect',
|
||||||
|
'embed': 'embed',
|
||||||
'expand': 'expand',
|
'expand': 'expand',
|
||||||
'next': 'next',
|
'next': 'next',
|
||||||
'prev': 'prev',
|
'prev': 'prev',
|
||||||
'select': 'select'
|
'selectSnipt': 'select'
|
||||||
},
|
},
|
||||||
|
|
||||||
copy: function() {
|
copy: function() {
|
||||||
var cmd;
|
if (!this.$copyModal.is(':visible')) {
|
||||||
if (navigator.platform == 'MacPPC' ||
|
var cmd;
|
||||||
navigator.platform == 'MacIntel') {
|
if (navigator.platform == 'MacPPC' ||
|
||||||
cmd = 'Cmd';
|
navigator.platform == 'MacIntel') {
|
||||||
|
cmd = 'Cmd';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cmd = 'Ctrl';
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$copyModalBody.append('<textarea class="raw"></textarea>');
|
||||||
|
$textarea = $('textarea.raw', this.$copyModalBody).val(this.$raw.text());
|
||||||
|
|
||||||
|
this.$copyModalType.text(cmd);
|
||||||
|
this.$copyModal.modal('show');
|
||||||
|
$textarea.select();
|
||||||
}
|
}
|
||||||
else {
|
},
|
||||||
cmd = 'Ctrl';
|
copyClose: function() {
|
||||||
}
|
$('textarea', this.$copyModal).remove();
|
||||||
window.prompt('Text is selected. To copy: press ' + cmd + '+C then <Enter>', this.$raw.text());
|
},
|
||||||
|
copyFromClick: function() {
|
||||||
|
this.copy();
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
deselect: function() {
|
deselect: function() {
|
||||||
this.$el.removeClass('selected');
|
if (!this.$copyModal.is(':visible')) {
|
||||||
window.$selected = false;
|
this.$el.removeClass('selected');
|
||||||
|
window.$selected = false;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
detail: function() {
|
detail: function() {
|
||||||
window.location = this.model.get('url');
|
window.location = this.model.get('url');
|
||||||
|
@ -1061,18 +1092,22 @@ jQuery(function($) {
|
||||||
this.$container.toggleClass('expanded', 100);
|
this.$container.toggleClass('expanded', 100);
|
||||||
this.$tags.toggleClass('expanded');
|
this.$tags.toggleClass('expanded');
|
||||||
this.select();
|
this.select();
|
||||||
return false;
|
},
|
||||||
|
embed: function() {
|
||||||
|
alert('TODO');
|
||||||
},
|
},
|
||||||
next: function() {
|
next: function() {
|
||||||
|
window.site.$copyModals.modal('hide');
|
||||||
nextSnipt = this.$el.next('article.snipt');
|
nextSnipt = this.$el.next('article.snipt');
|
||||||
if (nextSnipt.length) {
|
if (nextSnipt.length) {
|
||||||
return nextSnipt.trigger('select');
|
return nextSnipt.trigger('selectSnipt');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
prev: function() {
|
prev: function() {
|
||||||
|
window.site.$copyModals.modal('hide');
|
||||||
prevSnipt = this.$el.prev('article.snipt');
|
prevSnipt = this.$el.prev('article.snipt');
|
||||||
if (prevSnipt.length) {
|
if (prevSnipt.length) {
|
||||||
return prevSnipt.trigger('select');
|
return prevSnipt.trigger('selectSnipt');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
select: function(fromClick) {
|
select: function(fromClick) {
|
||||||
|
@ -1117,8 +1152,23 @@ jQuery(function($) {
|
||||||
$selected = window.selected;
|
$selected = window.selected;
|
||||||
$document = $(document);
|
$document = $(document);
|
||||||
|
|
||||||
$document.bind('keydown', 'c', function() {
|
$document.bind('keydown', 'j', function() {
|
||||||
|
if (!$selected) {
|
||||||
|
SniptList.$snipts.eq(0).trigger('selectSnipt');
|
||||||
|
} else {
|
||||||
|
$selected.trigger('next');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$document.bind('keydown', 'k', function() {
|
||||||
|
if (!$selected) {
|
||||||
|
SniptList.$snipts.eq(0).trigger('selectSnipt');
|
||||||
|
} else {
|
||||||
|
$selected.trigger('prev');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$document.bind('keydown', 'c', function(e) {
|
||||||
if ($selected) {
|
if ($selected) {
|
||||||
|
e.preventDefault();
|
||||||
$selected.trigger('copy');
|
$selected.trigger('copy');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1149,20 +1199,6 @@ jQuery(function($) {
|
||||||
$document.bind('keydown', 'h', function() {
|
$document.bind('keydown', 'h', function() {
|
||||||
window.location = '/';
|
window.location = '/';
|
||||||
});
|
});
|
||||||
$document.bind('keydown', 'j', function() {
|
|
||||||
if (!$selected) {
|
|
||||||
SniptList.$snipts.eq(0).trigger('select');
|
|
||||||
} else {
|
|
||||||
$selected.trigger('next');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$document.bind('keydown', 'k', function() {
|
|
||||||
if (!$selected) {
|
|
||||||
SniptList.$snipts.eq(0).trigger('select');
|
|
||||||
} else {
|
|
||||||
$selected.trigger('prev');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$document.bind('keydown', 'n', function() {
|
$document.bind('keydown', 'n', function() {
|
||||||
var $anc = $('li.next a');
|
var $anc = $('li.next a');
|
||||||
if ($anc.length) {
|
if ($anc.length) {
|
||||||
|
@ -1184,6 +1220,11 @@ jQuery(function($) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
$document.bind('keydown', 'v', function() {
|
||||||
|
if ($selected) {
|
||||||
|
$selected.trigger('embed');
|
||||||
|
}
|
||||||
|
});
|
||||||
$document.bind('keydown', 'return', function() {
|
$document.bind('keydown', 'return', function() {
|
||||||
if ($selected) {
|
if ($selected) {
|
||||||
$selected.trigger('detail');
|
$selected.trigger('detail');
|
||||||
|
|
|
@ -296,6 +296,7 @@ section.main aside.main nav.footer ul {
|
||||||
}
|
}
|
||||||
section.main aside.main nav.footer ul li {
|
section.main aside.main nav.footer ul li {
|
||||||
background: transparent url('https://snipt.s3.amazonaws.com/images/api-icon.png') center left no-repeat;
|
background: transparent url('https://snipt.s3.amazonaws.com/images/api-icon.png') center left no-repeat;
|
||||||
|
list-style-type: none;
|
||||||
margin: 6px 0 6px 0;
|
margin: 6px 0 6px 0;
|
||||||
padding-left: 22px;
|
padding-left: 22px;
|
||||||
}
|
}
|
||||||
|
@ -637,6 +638,11 @@ article.snipt.selected div.container {
|
||||||
article.snipt.selected div.container:after {
|
article.snipt.selected div.container:after {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
article.snipt div.copy-modal textarea {
|
||||||
|
height: 200px;
|
||||||
|
margin: 0;
|
||||||
|
width: 520px;
|
||||||
|
}
|
||||||
article.private-snipt div.container header {
|
article.private-snipt div.container header {
|
||||||
background: #fffdf9 url('https://snipt.s3.amazonaws.com/images/private-icon.png') top right no-repeat;
|
background: #fffdf9 url('https://snipt.s3.amazonaws.com/images/private-icon.png') top right no-repeat;
|
||||||
background: url('https://snipt.s3.amazonaws.com/images/private-icon.png') top right no-repeat, -webkit-gradient(linear, left top, left bottom, from(#ffffff), to(#fffaf2));
|
background: url('https://snipt.s3.amazonaws.com/images/private-icon.png') top right no-repeat, -webkit-gradient(linear, left top, left bottom, from(#ffffff), to(#fffaf2));
|
||||||
|
@ -656,6 +662,27 @@ div.pagination ul {
|
||||||
div.pagination ul li a {
|
div.pagination ul li a {
|
||||||
color: #3BAAF3;
|
color: #3BAAF3;
|
||||||
}
|
}
|
||||||
|
div.modal .modal-header .close {
|
||||||
|
line-height: 20px;
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
div.modal .modal-header h3 span {
|
||||||
|
display: inline-block;
|
||||||
|
max-width: 400px;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
div.modal .modal-header h4 {
|
||||||
|
color: #AAA;
|
||||||
|
margin-top: 1px;
|
||||||
|
}
|
||||||
|
div#keyboard-shortcuts {
|
||||||
|
max-height: 501px;
|
||||||
|
}
|
||||||
|
div#keyboard-shortcuts table {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
body.detail div.right-y {
|
body.detail div.right-y {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue