master
parent
1fabd87220
commit
c78ae35ce5
File diff suppressed because it is too large
Load Diff
|
@ -87,7 +87,13 @@ b,c){a=document.createElement(a);b&&g(a).attr(b);c&&g(a).html(c);return a},deleg
|
|||
0,c=n.length;b<c;b++){var d=n[b];a[d]&&(this[d]=a[d])}this.options=a},_ensureElement:function(){if(this.el){if(f.isString(this.el))this.el=g(this.el).get(0)}else{var a=this.attributes||{};if(this.id)a.id=this.id;if(this.className)a["class"]=this.className;this.el=this.make(this.tagName,a)}}});e.Model.extend=e.Collection.extend=e.Router.extend=e.View.extend=function(a,b){var c=v(this,a,b);c.extend=this.extend;return c};var w={create:"POST",update:"PUT","delete":"DELETE",read:"GET"};e.sync=function(a,
|
||||
b,c){var d=w[a];c=f.extend({type:d,dataType:"json"},c);if(!c.url)c.url=k(b)||l();if(!c.data&&b&&(a=="create"||a=="update"))c.contentType="application/json",c.data=JSON.stringify(b.toJSON());if(e.emulateJSON)c.contentType="application/x-www-form-urlencoded",c.data=c.data?{model:c.data}:{};if(e.emulateHTTP&&(d==="PUT"||d==="DELETE")){if(e.emulateJSON)c.data._method=d;c.type="POST";c.beforeSend=function(a){a.setRequestHeader("X-HTTP-Method-Override",d)}}if(c.type!=="GET"&&!e.emulateJSON)c.processData=
|
||||
!1;return g.ajax(c)};var o=function(){},v=function(a,b,c){var d;d=b&&b.hasOwnProperty("constructor")?b.constructor:function(){return a.apply(this,arguments)};f.extend(d,a);o.prototype=a.prototype;d.prototype=new o;b&&f.extend(d.prototype,b);c&&f.extend(d,c);d.prototype.constructor=d;d.__super__=a.prototype;return d},k=function(a){if(!a||!a.url)return null;return f.isFunction(a.url)?a.url():a.url},l=function(){throw Error('A "url" property or function must be specified');},i=function(a,b,c){return function(d){a?
|
||||
a(b,d,c):b.trigger("error",b,d,c)}}}).call(this);(function(jQuery){jQuery.hotkeys={version:"0.8",specialKeys:{8:"backspace",9:"tab",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",191:"/",224:"meta"},shiftNums:{"`":"~","1":"!","2":"@","3":"#","4":"$","5":"%","6":"^","7":"&","8":"*","9":"(","0":")","-":"_","=":"+",";":": ","'":"\"",",":"<",".":">","/":"?","\\":"|"}};function keyHandler(handleObj){if(typeof handleObj.data!=="string"){return;}
|
||||
a(b,d,c):b.trigger("error",b,d,c)}}}).call(this);/**
|
||||
* Bootstrap.js by @fat & @mdo
|
||||
* plugins: bootstrap-modal.js
|
||||
* Copyright 2012 Twitter, Inc.
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.txt
|
||||
*/
|
||||
!function(a){function c(){var b=this,c=setTimeout(function(){b.$element.off(a.support.transition.end),d.call(b)},500);this.$element.one(a.support.transition.end,function(){clearTimeout(c),d.call(b)})}function d(a){this.$element.hide().trigger("hidden"),e.call(this)}function e(b){var c=this,d=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var e=a.support.transition&&d;this.$backdrop=a('<div class="modal-backdrop '+d+'" />').appendTo(document.body),this.options.backdrop!="static"&&this.$backdrop.click(a.proxy(this.hide,this)),e&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),e?this.$backdrop.one(a.support.transition.end,b):b()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(a.support.transition.end,a.proxy(f,this)):f.call(this)):b&&b()}function f(){this.$backdrop.remove(),this.$backdrop=null}function g(){var b=this;this.isShown&&this.options.keyboard?a(document).on("keyup.dismiss.modal",function(a){a.which==27&&b.hide()}):this.isShown||a(document).off("keyup.dismiss.modal")}"use strict";var b=function(b,c){this.options=a.extend({},a.fn.modal.defaults,c),this.$element=a(b).delegate('[data-dismiss="modal"]',"click.dismiss.modal",a.proxy(this.hide,this))};b.prototype={constructor:b,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var b=this;if(this.isShown)return;this.isShown=!0,this.$element.trigger("show"),g.call(this),e.call(this,function(){var c=a.support.transition&&b.$element.hasClass("fade");!b.$element.parent().length&&b.$element.appendTo(document.body),b.$element.show(),c&&b.$element[0].offsetWidth,b.$element.addClass("in"),c?b.$element.one(a.support.transition.end,function(){b.$element.trigger("shown")}):b.$element.trigger("shown")})},hide:function(b){b&&b.preventDefault();if(!this.isShown)return;var e=this;this.isShown=!1,g.call(this),this.$element.trigger("hide").removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?c.call(this):d.call(this)}},a.fn.modal=function(c){return this.each(function(){var d=a(this),e=d.data("modal"),f=typeof c=="object"&&c;e||d.data("modal",e=new b(this,f)),typeof c=="string"?e[c]():e.show()})},a.fn.modal.defaults={backdrop:!0,keyboard:!0},a.fn.modal.Constructor=b,a(function(){a("body").on("click.modal.data-api",'[data-toggle="modal"]',function(b){var c=a(this),d=a(c.attr("data-target")||c.attr("href")),e=d.data("modal")?"toggle":a.extend({},d.data(),c.data());b.preventDefault(),d.modal(e)})})}(window.jQuery)(function(jQuery){jQuery.hotkeys={version:"0.8",specialKeys:{8:"backspace",9:"tab",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",191:"/",224:"meta"},shiftNums:{"`":"~","1":"!","2":"@","3":"#","4":"$","5":"%","6":"^","7":"&","8":"*","9":"(","0":")","-":"_","=":"+",";":": ","'":"\"",",":"<",".":">","/":"?","\\":"|"}};function keyHandler(handleObj){if(typeof handleObj.data!=="string"){return;}
|
||||
var origHandler=handleObj.handler,keys=handleObj.data.toLowerCase().split(" ");handleObj.handler=function(event){if(this!==event.target&&(/textarea|select/i.test(event.target.nodeName)||event.target.type==="text")){return;}
|
||||
var special=event.type!=="keypress"&&jQuery.hotkeys.specialKeys[event.which],character=String.fromCharCode(event.which).toLowerCase(),key,modif="",possible={};if(event.altKey&&special!=="alt"){modif+="alt+";}
|
||||
if(event.ctrlKey&&special!=="ctrl"){modif+="ctrl+";}
|
||||
|
@ -921,8 +927,9 @@ jQuery(function($) {
|
|||
|
||||
initialize: function(opts) {
|
||||
|
||||
this.$search_query = $('input#search-query', this.el);
|
||||
this.$snipts = $('section#snipts article.snipt', this.el);
|
||||
this.$el = $(this.el);
|
||||
this.$search_query = $('input#search-query', this.$el);
|
||||
this.$snipts = $('section#snipts article.snipt', this.$el);
|
||||
|
||||
this.keyboardShortcuts();
|
||||
this.inFieldLabels();
|
||||
|
@ -931,6 +938,12 @@ jQuery(function($) {
|
|||
if (this.$snipts.length) {
|
||||
SniptListView = Snipt.Views.SniptListView;
|
||||
SniptList = new SniptListView({ 'snipts': this.$snipts });
|
||||
|
||||
$('body').click(function() {
|
||||
if (window.$selected) {
|
||||
window.$selected.trigger('deselect');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Search
|
||||
|
@ -941,7 +954,12 @@ jQuery(function($) {
|
|||
});
|
||||
|
||||
},
|
||||
events: {
|
||||
'showKeyboardShortcuts': 'showKeyboardShortcuts'
|
||||
},
|
||||
|
||||
keyboardShortcuts: function() {
|
||||
var $el = this.$el;
|
||||
|
||||
$search_query = this.$search_query;
|
||||
$document = $(document);
|
||||
|
@ -952,19 +970,25 @@ jQuery(function($) {
|
|||
$search_query.focus();
|
||||
});
|
||||
|
||||
$document.bind('keydown', 'Shift+/', function(e) {
|
||||
$el.trigger('showKeyboardShortcuts');
|
||||
});
|
||||
|
||||
// Escape
|
||||
$('input').bind('keydown', 'esc', function(e) {
|
||||
e.preventDefault();
|
||||
this.blur();
|
||||
});
|
||||
},
|
||||
showKeyboardShortcuts: function() {
|
||||
$('#keyboard-shortcuts').modal('toggle');
|
||||
},
|
||||
inFieldLabels: function () {
|
||||
$('div.infield label', this.el).inFieldLabels({
|
||||
$('div.infield label', this.$el).inFieldLabels({
|
||||
fadeDuration: 200
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Site.Views = {
|
||||
'SiteView': SiteView
|
||||
};
|
||||
|
@ -1060,8 +1084,9 @@ jQuery(function($) {
|
|||
|
||||
window.$selected = this.$el;
|
||||
},
|
||||
selectFromClick: function() {
|
||||
selectFromClick: function(e) {
|
||||
this.select(true);
|
||||
e.stopPropagation();
|
||||
}
|
||||
});
|
||||
SniptListView = Backbone.View.extend({
|
||||
|
@ -1075,6 +1100,7 @@ jQuery(function($) {
|
|||
|
||||
this.keyboardShortcuts();
|
||||
},
|
||||
|
||||
addSnipt: function() {
|
||||
model = new SniptView({ el: this });
|
||||
},
|
||||
|
|
|
@ -6,6 +6,9 @@ body {
|
|||
font: normal 14px 'Helvetica Neue', Helvetica, Arial, 'Liberation Sans', FreeSans, sans-serif;
|
||||
text-rendering: optimizeLegibility;
|
||||
}
|
||||
body li {
|
||||
line-height: normal;
|
||||
}
|
||||
header.main {
|
||||
background: #12343d url('https://snipt.s3.amazonaws.com/images/header-bg.gif') top left repeat-x;
|
||||
border-bottom: 1px solid #DDDDDD;
|
||||
|
@ -138,26 +141,44 @@ header.sub div.inner {
|
|||
width: 939px;
|
||||
z-index: 49;
|
||||
}
|
||||
header.sub div.inner ul {
|
||||
header.sub div.inner ul.bcrumb {
|
||||
border-right: 1px solid #d0d0d0;
|
||||
float: left;
|
||||
margin: 0;
|
||||
padding-left: 16px;
|
||||
width: 733px;
|
||||
}
|
||||
header.sub div.inner ul li {
|
||||
header.sub div.inner ul.bcrumb li {
|
||||
display: inline-block;
|
||||
padding: 4px 0 6px 0;
|
||||
max-width: 490px;
|
||||
line-height: normal;
|
||||
overflow: hidden;
|
||||
padding: 4px 0 7px 0;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
header.sub div.inner ul li a {
|
||||
header.sub div.inner ul.bcrumb li a {
|
||||
color: #999999;
|
||||
font: bold 12px Consolas, Menlo, "Courier New", monospace;
|
||||
text-decoration: none;
|
||||
text-shadow: 0 1px 0 #FFF;
|
||||
}
|
||||
header.sub div.inner ul li.prompt {
|
||||
header.sub div.inner ul.bcrumb li a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
header.sub div.inner ul.bcrumb li.prompt {
|
||||
color: #999999;
|
||||
font: bold 12px Consolas, Menlo, "Courier New", monospace;
|
||||
margin-right: 3px;
|
||||
text-shadow: 0 1px 0 #FFF;
|
||||
}
|
||||
header.sub div.inner div.shortcuts {
|
||||
color: #999999;
|
||||
float: right;
|
||||
font: bold 12px Consolas, Menlo, "Courier New", monospace;
|
||||
padding-top: 6px;
|
||||
text-shadow: 0 1px 0 #FFF;
|
||||
}
|
||||
section.main {
|
||||
height: 100%;
|
||||
margin: 0 auto;
|
||||
|
@ -246,6 +267,7 @@ section.main aside.main section.tags ul {
|
|||
margin: 0 0 15px 0;
|
||||
}
|
||||
section.main aside.main section.tags ul li {
|
||||
list-style-type: none;
|
||||
margin: 6px 0 6px 22px;
|
||||
}
|
||||
section.main aside.main section.tags a {
|
||||
|
@ -371,6 +393,7 @@ article.snipt div.container header h2 {
|
|||
padding: 3px 8px 2px 8px;
|
||||
}
|
||||
article.snipt div.container section.code {
|
||||
background-color: #FFF;
|
||||
height: 200px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
|
@ -481,7 +504,11 @@ article.snipt aside {
|
|||
margin: 23px 30px 0 0;
|
||||
width: 100px;
|
||||
}
|
||||
article.snipt aside ul.options {
|
||||
margin: 0;
|
||||
}
|
||||
article.snipt aside ul.options li {
|
||||
list-style-type: none;
|
||||
margin: 2px 0;
|
||||
}
|
||||
article.snipt aside ul.options li a {
|
||||
|
@ -492,6 +519,7 @@ article.snipt aside ul.options li a {
|
|||
opacity: .5;
|
||||
padding: 7px 10px 7px 35px;
|
||||
position: relative;
|
||||
text-decoration: none;
|
||||
}
|
||||
article.snipt aside ul.options li a:hover, article.snipt aside ul.options li a.hover {
|
||||
background-color: rgba(128, 128, 128, 0.18);
|
||||
|
@ -526,8 +554,12 @@ article.snipt aside section.tags h2 {
|
|||
font: bold 12px 'Helvetica Neue', Helvetica, Arial, 'Liberation Sans', FreeSans, sans-serif;
|
||||
padding: 7px 0 7px 35px;
|
||||
}
|
||||
article.snipt aside section.tags ul {
|
||||
margin: 0;
|
||||
}
|
||||
article.snipt aside section.tags ul li {
|
||||
margin: 6px 10px 6px 35px;
|
||||
list-style-type: none;
|
||||
margin: 5px 10px 5px 35px;
|
||||
}
|
||||
article.snipt aside section.tags ul li a {
|
||||
border-bottom: 1px solid #999;
|
||||
|
@ -620,21 +652,9 @@ div.pagination {
|
|||
}
|
||||
div.pagination ul {
|
||||
background: #FFF;
|
||||
display: inline-block;
|
||||
float: none;
|
||||
}
|
||||
div.pagination ul li a {
|
||||
color: #3BAAF3;
|
||||
padding: 0 8px;
|
||||
}
|
||||
div.pagination ul li a:hover {
|
||||
background: #EAE8EB;
|
||||
}
|
||||
div.pagination ul li.active a {
|
||||
background: #E0E1E1;
|
||||
}
|
||||
div.pagination ul li.prev {
|
||||
line-height: 2px;
|
||||
}
|
||||
body.detail div.right-y {
|
||||
display: none;
|
||||
|
|
Loading…
Reference in New Issue