Two-spaces yo.

master
Nick Sergeant 2013-10-19 20:48:25 -04:00
parent 3a1d8ca8c0
commit 8b6e11f348
2 changed files with 189 additions and 189 deletions

View File

@ -172,7 +172,7 @@ if(destroyed){window.$selected.trigger('fadeAndRemove');}}else{if(!window.ui_hal
window.site.$aside_nav.removeClass('open');}}},keyboardShortcuts:function(){var that=this;$selected=window.selected;$document=$(document);$document.bind('keydown','j',function(){if(!window.ui_halted){if(!$selected){window.site.$snipts.eq(0).trigger('selectSnipt');}else{$selected.trigger('next');}}});$document.bind('keydown','k',function(){if(!window.ui_halted){if(!$selected){window.site.$snipts.eq(0).trigger('selectSnipt');}else{$selected.trigger('prev');}}});$document.bind('keydown','c',function(e){if(!window.ui_halted&&!window.blog_post){if($selected){e.preventDefault();$selected.trigger('copyRaw');}}});$document.bind('keydown','Ctrl+e',function(){if(!window.ui_halted){if($selected){if($selected.hasClass('editable')){$selected.trigger('edit');}}}});$document.bind('keydown','Ctrl+backspace',function(){if(!window.ui_halted||window.editing){if($selected){if($selected.hasClass('editable')){if(confirm('Are you sure you want to delete this snipt?')){$selected.trigger('destroy');window.site.snipt_list.escapeUI(true);}}}}});$document.bind('keydown','Ctrl+del',function(){if(!window.ui_halted||window.editing){if($selected){if($selected.hasClass('editable')){if(confirm('Are you sure you want to delete this snipt?')){$selected.trigger('destroy');window.site.snipt_list.escapeUI(true);}}}}});$document.bind('keydown','Alt+n',function(){if(!window.ui_halted){that.addNewSnipt();}});$document.bind('keydown','Ctrl+n',function(){if(!window.ui_halted){that.addNewSnipt();}});$document.bind('keydown','Ctrl+s',function(){if(window.editing){if($selected){if($selected.hasClass('editable')){$('button.save').click();}}}});$document.bind('keydown','Ctrl+c',function(){if(window.editing){if($selected){if($selected.hasClass('editable')){$('button.save-and-close').click();}}}});$document.bind('keydown','esc',function(){that.escapeUI();});$document.bind('keydown','g',function(){if(!window.ui_halted){if(window.$selected){window.$selected.trigger('deselect');}
window.scrollTo(0,0);}});$document.bind('keydown','Shift+g',function(){if(!window.ui_halted){if(window.$selected){window.$selected.trigger('deselect');}
window.scrollTo(0,document.body.scrollHeight);}});$document.bind('keydown','n',function(){if(!window.ui_halted){var $anc=$('li.next a');if($anc.length){if($anc.attr('href')!=='#'){window.location=$anc.attr('href');}}}});$document.bind('keydown','e',function(){if(!window.ui_halted){if($selected){if($selected.hasClass('expandable')){$selected.trigger('expand');}}}});$document.bind('keydown','u',function(){if(!window.ui_halted){if($selected){$selected.trigger('goToAuthor');}}});$document.bind('keydown','p',function(){if(!window.ui_halted){var $anc=$('li.prev a');if($anc.length){if($anc.attr('href')!=='#'){window.location=$anc.attr('href');}}}});$document.bind('keydown','v',function(e){if(!window.ui_halted&&!window.blog_post){if($selected){e.preventDefault();$selected.trigger('embed');}}});$document.bind('keydown','o',function(){if(!window.ui_halted){if($selected){$selected.trigger('detail');}}});$document.bind('keydown','return',function(){if(!window.ui_halted){if($selected){$selected.trigger('detail');}}});}});})(snipt.module('snipt'));
(function(){if(typeof angular!=='undefined'){var root=this;var $=root.jQuery;var controllers={};var app=root.app;app.config(function($routeProvider){$routeProvider.when('/account/',{templateUrl:'/static/js/src/modules/partials/profile.html',controller:controllers.ProfileController});$routeProvider.when('/account/billing/',{templateUrl:'/static/js/src/modules/partials/billing.html',controller:controllers.BillingController});$routeProvider.when('/account/blogging/',{templateUrl:'/static/js/src/modules/partials/blogging.html',controller:controllers.BloggingController});$routeProvider.when('/account/editor/',{templateUrl:'/static/js/src/modules/partials/editor.html',controller:controllers.EditorController});$routeProvider.otherwise({'redirectTo':function(routeParams,locationPath){window.location=locationPath;}});});app.factory('AccountStorage',function($http){return{getAccount:function(){var promise=$http({method:'GET',url:'/api/private/profile/'+window.user_profile_id+'/',headers:{'Authorization':'ApiKey '+window.user+':'+window.api_key}});return promise;},saveAccount:function(user,fields){var promise=$http({method:'PUT',url:'/api/private/profile/'+window.user_profile_id+'/',headers:{'Authorization':'ApiKey '+window.user+':'+window.api_key},data:function(){var userData={};for(var i=0;i<fields.length;i++){userData[fields[i]]=user[fields[i]];}
(function(){'use strict';if(typeof angular!=='undefined'){var root=this;var $=root.jQuery;var controllers={};var app=root.app;app.config(function($routeProvider){$routeProvider.when('/account/',{templateUrl:'/static/js/src/modules/partials/profile.html',controller:controllers.ProfileController});$routeProvider.when('/account/billing/',{templateUrl:'/static/js/src/modules/partials/billing.html',controller:controllers.BillingController});$routeProvider.when('/account/blogging/',{templateUrl:'/static/js/src/modules/partials/blogging.html',controller:controllers.BloggingController});$routeProvider.when('/account/editor/',{templateUrl:'/static/js/src/modules/partials/editor.html',controller:controllers.EditorController});$routeProvider.otherwise({'redirectTo':function(routeParams,locationPath){window.location=locationPath;}});});app.factory('AccountStorage',function($http){return{getAccount:function(){var promise=$http({method:'GET',url:'/api/private/profile/'+window.user_profile_id+'/',headers:{'Authorization':'ApiKey '+window.user+':'+window.api_key}});return promise;},saveAccount:function(user,fields){var promise=$http({method:'PUT',url:'/api/private/profile/'+window.user_profile_id+'/',headers:{'Authorization':'ApiKey '+window.user+':'+window.api_key},data:function(){var userData={};for(var i=0;i<fields.length;i++){userData[fields[i]]=user[fields[i]];}
return userData;}()});return promise;}};});controllers.BillingController=function($scope){$scope.section='Billing';};controllers.BloggingController=function($scope){$scope.fields=['blog_title','blog_theme','blog_domain','gittip_username','disqus_shortname','google_analytics_tracking_id','gauges_site_id','google_ad_client','google_ad_slot','google_ad_width','google_ad_height'];$scope.section='Blogging';$scope.blogThemeOptions=[{id:'D',label:'Default'},{id:'A',label:'Pro Adams'}];};controllers.EditorController=function($scope){$scope.fields=['default_editor','editor_theme'];$scope.section='Editor';$scope.editorOptions=[{id:'C',label:'CodeMirror'},{id:'T',label:'Textarea'}];$scope.editorThemeOptions=[{id:'default',label:'Default'},{id:'ambiance',label:'Ambiance'},{id:'blackboard',label:'Blackboard'},{id:'cobalt',label:'Cobalt'},{id:'eclipse',label:'Eclipse'},{id:'elegant',label:'Elegant'},{id:'erlang-dark',label:'Erlang Dark'},{id:'lesser-dark',label:'Lesser Dark'},{id:'monokai',label:'Monokai'},{id:'neat',label:'Neat'},{id:'night',label:'Night'},{id:'rubyblue',label:'Ruby Blue'},{id:'solarized dark',label:'Solarized Dark'},{id:'solarized light',label:'Solarized Light'},{id:'twilight',label:'Twilight'},{id:'vibrant-ink',label:'Vibrant Ink'},{id:'xq-dark',label:'XQ Dark'}];};controllers.AccountController=function($scope,$route,AccountStorage){$scope.errors=[];$scope.saveButtonText='Save';$scope.route=$route;AccountStorage.getAccount().then(function(response){$scope.user=response.data;});$scope.saveFields=function(fields){$scope.saveButtonText='Saving…';AccountStorage.saveAccount($scope.user,fields).then(function onSuccess(response){$scope.user=response.data;$scope.success=true;$scope.message=$scope.route.current.scope.section+' settings saved.';$scope.saveButtonText='Save';$scope.errors=[];setTimeout(function(){$scope.success=null;$scope.message='';$scope.$apply();},3000);},function onError(response){$scope.success=false;$scope.saveButtonText='Save';if(response){$scope.errors=response.data.profile;$scope.message='Only spaces, letters, numbers, underscores, dashes, periods, forward slashes, and "at sign" are valid.';}else{$scope.message='There was an error saving your settings.';}});};};controllers.ProfileController=function($scope){$scope.section='Profile';};app.controller(controllers);}}).call(this);
(function(){'use strict';if(typeof angular!=='undefined'){var root=this;var $=root.jQuery;var controllers={};var app=root.app;controllers.SniptListController=function($scope,AccountStorage){$scope.$root.account={list_view:'N'};AccountStorage.getAccount().then(function(response){$scope.$root.account=response.data;});$scope.$root.$watch('account.list_view',function(oldView,newView){if(oldView!==newView){AccountStorage.saveAccount($scope.$root.account,['list_view']).then(function(response){$scope.$root.account=response.data;});}});};app.controller(controllers);}}).call(this);
(function(){if(typeof angular!=='undefined'){var root=this;var $=root.jQuery;var controllers={};var app=root.app;app.factory('SearchService',function(){return{mineOnly:false,query:''};});controllers.HeaderSearchController=function($scope,SearchService){$scope.search=SearchService;};controllers.SearchController=function($scope,SearchService){$scope.search=SearchService;$scope.$watch('search.query',function(query){if(query.indexOf('--mine')!==-1){$scope.search.mineOnly=true;}else{$scope.search.mineOnly=false;}});$scope.toggleMineOnly=function(){if($scope.search.mineOnly){if($scope.search.query.indexOf('--mine')===-1){$scope.search.query=$scope.search.query.trim()+' --mine';}}

View File

@ -1,203 +1,203 @@
(function() {
(function() { 'use strict';
if (typeof angular !== 'undefined') {
if (typeof angular !== 'undefined') {
var root = this;
var $ = root.jQuery;
var controllers = {};
var app = root.app;
var root = this;
var $ = root.jQuery;
var controllers = {};
var app = root.app;
// App definition.
app.config(function($routeProvider) {
// App definition.
app.config(function($routeProvider) {
// Routes.
$routeProvider.when('/account/', {
templateUrl: '/static/js/src/modules/partials/profile.html',
controller: controllers.ProfileController
});
$routeProvider.when('/account/billing/', {
templateUrl: '/static/js/src/modules/partials/billing.html',
controller: controllers.BillingController
});
$routeProvider.when('/account/blogging/', {
templateUrl: '/static/js/src/modules/partials/blogging.html',
controller: controllers.BloggingController
});
$routeProvider.when('/account/editor/', {
templateUrl: '/static/js/src/modules/partials/editor.html',
controller: controllers.EditorController
});
// Routes.
$routeProvider.when('/account/', {
templateUrl: '/static/js/src/modules/partials/profile.html',
controller: controllers.ProfileController
});
$routeProvider.when('/account/billing/', {
templateUrl: '/static/js/src/modules/partials/billing.html',
controller: controllers.BillingController
});
$routeProvider.when('/account/blogging/', {
templateUrl: '/static/js/src/modules/partials/blogging.html',
controller: controllers.BloggingController
});
$routeProvider.when('/account/editor/', {
templateUrl: '/static/js/src/modules/partials/editor.html',
controller: controllers.EditorController
});
$routeProvider.otherwise({
'redirectTo': function(routeParams, locationPath) {
window.location = locationPath;
}
});
$routeProvider.otherwise({
'redirectTo': function(routeParams, locationPath) {
window.location = locationPath;
}
});
});
// Services.
app.factory('AccountStorage', function($http) {
return {
getAccount: function() {
var promise = $http({
method: 'GET',
url: '/api/private/profile/' + window.user_profile_id + '/',
headers: {
'Authorization': 'ApiKey ' + window.user + ':' + window.api_key
}
});
// Services.
app.factory('AccountStorage', function($http) {
return {
getAccount: function() {
return promise;
},
saveAccount: function(user, fields) {
var promise = $http({
method: 'GET',
url: '/api/private/profile/' + window.user_profile_id + '/',
headers: {
'Authorization': 'ApiKey ' + window.user + ':' + window.api_key
}
});
var promise = $http({
method: 'PUT',
url: '/api/private/profile/' + window.user_profile_id + '/',
headers: {
'Authorization': 'ApiKey ' + window.user + ':' + window.api_key
},
data: function() {
var userData = {};
return promise;
},
saveAccount: function(user, fields) {
for (var i = 0; i < fields.length; i++) {
userData[fields[i]] = user[fields[i]];
}
var promise = $http({
method: 'PUT',
url: '/api/private/profile/' + window.user_profile_id + '/',
headers: {
'Authorization': 'ApiKey ' + window.user + ':' + window.api_key
},
data: function() {
var userData = {};
for (var i = 0; i < fields.length; i++) {
userData[fields[i]] = user[fields[i]];
}
return userData;
}()
});
return promise;
}
};
});
// Controllers.
controllers.BillingController = function($scope) {
$scope.section = 'Billing';
};
controllers.BloggingController = function($scope) {
$scope.fields = [
'blog_title',
'blog_theme',
'blog_domain',
'gittip_username',
'disqus_shortname',
'google_analytics_tracking_id',
'gauges_site_id',
'google_ad_client',
'google_ad_slot',
'google_ad_width',
'google_ad_height'
];
$scope.section = 'Blogging';
$scope.blogThemeOptions = [
{ id: 'D', label: 'Default' },
{ id: 'A', label: 'Pro Adams' }
];
};
controllers.EditorController = function($scope) {
$scope.fields = ['default_editor', 'editor_theme'];
$scope.section = 'Editor';
$scope.editorOptions = [
{ id: 'C', label: 'CodeMirror' },
{ id: 'T', label: 'Textarea' }
];
$scope.editorThemeOptions = [
{ id: 'default', label: 'Default' },
{ id: 'ambiance', label: 'Ambiance' },
{ id: 'blackboard', label: 'Blackboard' },
{ id: 'cobalt', label: 'Cobalt' },
{ id: 'eclipse', label: 'Eclipse' },
{ id: 'elegant', label: 'Elegant' },
{ id: 'erlang-dark', label: 'Erlang Dark' },
{ id: 'lesser-dark', label: 'Lesser Dark' },
{ id: 'monokai', label: 'Monokai' },
{ id: 'neat', label: 'Neat' },
{ id: 'night', label: 'Night' },
{ id: 'rubyblue', label: 'Ruby Blue' },
{ id: 'solarized dark', label: 'Solarized Dark' },
{ id: 'solarized light', label: 'Solarized Light' },
{ id: 'twilight', label: 'Twilight' },
{ id: 'vibrant-ink', label: 'Vibrant Ink' },
{ id: 'xq-dark', label: 'XQ Dark' }
];
};
controllers.AccountController = function($scope, $route, AccountStorage) {
$scope.errors = [];
$scope.saveButtonText = 'Save';
$scope.route = $route;
AccountStorage.getAccount().then(function(response) {
$scope.user = response.data;
});
$scope.saveFields = function(fields) {
$scope.saveButtonText = 'Saving…';
AccountStorage.saveAccount($scope.user, fields).then(function onSuccess(response) {
// Save the new user object.
$scope.user = response.data;
// Signal that we have a successful response.
$scope.success = true;
// Success message.
$scope.message = $scope.route.current.scope.section + ' settings saved.';
// Reset the save button text.
$scope.saveButtonText = 'Save';
// Clear out any marked errors.
$scope.errors = [];
// Remove the success message after a while.
setTimeout(function() {
$scope.success = null;
$scope.message = '';
// We have to apply since we're outside of the scope context.
$scope.$apply();
}, 3000);
}, function onError(response) {
// Signal that we have an error.
$scope.success = false;
// Reset the save button text.
$scope.saveButtonText = 'Save';
// If we have a response, then it's probably a validation error.
if (response) {
// Set the errors on the scope.
$scope.errors = response.data.profile;
$scope.message = 'Only spaces, letters, numbers, underscores, dashes, periods, forward slashes, and "at sign" are valid.';
} else {
$scope.message = 'There was an error saving your settings.';
}
});
};
};
controllers.ProfileController = function($scope) {
$scope.section = 'Profile';
};
// Assign the controllers.
app.controller(controllers);
return userData;
}()
});
return promise;
}
};
});
// Controllers.
controllers.BillingController = function($scope) {
$scope.section = 'Billing';
};
controllers.BloggingController = function($scope) {
$scope.fields = [
'blog_title',
'blog_theme',
'blog_domain',
'gittip_username',
'disqus_shortname',
'google_analytics_tracking_id',
'gauges_site_id',
'google_ad_client',
'google_ad_slot',
'google_ad_width',
'google_ad_height'
];
$scope.section = 'Blogging';
$scope.blogThemeOptions = [
{ id: 'D', label: 'Default' },
{ id: 'A', label: 'Pro Adams' }
];
};
controllers.EditorController = function($scope) {
$scope.fields = ['default_editor', 'editor_theme'];
$scope.section = 'Editor';
$scope.editorOptions = [
{ id: 'C', label: 'CodeMirror' },
{ id: 'T', label: 'Textarea' }
];
$scope.editorThemeOptions = [
{ id: 'default', label: 'Default' },
{ id: 'ambiance', label: 'Ambiance' },
{ id: 'blackboard', label: 'Blackboard' },
{ id: 'cobalt', label: 'Cobalt' },
{ id: 'eclipse', label: 'Eclipse' },
{ id: 'elegant', label: 'Elegant' },
{ id: 'erlang-dark', label: 'Erlang Dark' },
{ id: 'lesser-dark', label: 'Lesser Dark' },
{ id: 'monokai', label: 'Monokai' },
{ id: 'neat', label: 'Neat' },
{ id: 'night', label: 'Night' },
{ id: 'rubyblue', label: 'Ruby Blue' },
{ id: 'solarized dark', label: 'Solarized Dark' },
{ id: 'solarized light', label: 'Solarized Light' },
{ id: 'twilight', label: 'Twilight' },
{ id: 'vibrant-ink', label: 'Vibrant Ink' },
{ id: 'xq-dark', label: 'XQ Dark' }
];
};
controllers.AccountController = function($scope, $route, AccountStorage) {
$scope.errors = [];
$scope.saveButtonText = 'Save';
$scope.route = $route;
AccountStorage.getAccount().then(function(response) {
$scope.user = response.data;
});
$scope.saveFields = function(fields) {
$scope.saveButtonText = 'Saving…';
AccountStorage.saveAccount($scope.user, fields).then(function onSuccess(response) {
// Save the new user object.
$scope.user = response.data;
// Signal that we have a successful response.
$scope.success = true;
// Success message.
$scope.message = $scope.route.current.scope.section + ' settings saved.';
// Reset the save button text.
$scope.saveButtonText = 'Save';
// Clear out any marked errors.
$scope.errors = [];
// Remove the success message after a while.
setTimeout(function() {
$scope.success = null;
$scope.message = '';
// We have to apply since we're outside of the scope context.
$scope.$apply();
}, 3000);
}, function onError(response) {
// Signal that we have an error.
$scope.success = false;
// Reset the save button text.
$scope.saveButtonText = 'Save';
// If we have a response, then it's probably a validation error.
if (response) {
// Set the errors on the scope.
$scope.errors = response.data.profile;
$scope.message = 'Only spaces, letters, numbers, underscores, dashes, periods, forward slashes, and "at sign" are valid.';
} else {
$scope.message = 'There was an error saving your settings.';
}
});
};
};
controllers.ProfileController = function($scope) {
$scope.section = 'Profile';
};
// Assign the controllers.
app.controller(controllers);
}
}).call(this);