General upgrades: removing MixPanel, upgrading jQuery, Angular and Chosen.

master
Nick Sergeant 2014-04-30 09:35:20 -07:00
parent d4e56ea875
commit 20cb10266b
15 changed files with 467 additions and 1075 deletions

View File

@ -49,7 +49,7 @@
{% block sub-header %}
<header class="sub">
<div class="inner group">
<ul class="bcrumb">
<ul class="bcrumb group">
<li class="prompt">//</li>
<li><a href="/">blog</a></li>
{% block breadcrumb %}{% endblock %}

View File

@ -39,7 +39,11 @@ cat media/js/src/modules/site.js|jsmin > media/js/src/modules/site.min.js
cat media/js/src/modules/snipt.js|jsmin > media/js/src/modules/snipt.min.js
cat media/js/src/pro.js|jsmin > media/js/src/pro.min.js
cat media/js/libs/underscore.js \
cat media/js/libs/jquery.min.js \
media/js/libs/jquery-ui.min.js \
media/js/libs/angular.min.js \
media/js/libs/angular-route.min.js \
media/js/libs/underscore.js \
media/js/libs/json2.js \
media/js/libs/backbone.js \
media/js/libs/bootstrap.min.js \

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -379,6 +379,7 @@ header.sub {
li {
display: inline-block;
float: left;
line-height: normal;
max-width: 490px;
overflow: hidden;
@ -431,9 +432,11 @@ header.sub {
color: #999999;
font: bold 12px $Consolas;
margin-right: 3px;
margin-top: 2px;
text-shadow: 0 1px 0 #FFF;
}
span.prompt {
float: left;
margin-left: 3px;
}
}
@ -2316,6 +2319,12 @@ body.editing {
margin-top: 0;
width: 243px;
div.type-lexer {
padding-right: 10px;
}
div.chosen-container {
width: 100% !important;
}
label {
margin: 20px 0;

BIN
media/img/chosen-sprite.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 559 B

After

Width:  |  Height:  |  Size: 646 B

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,228 +1,198 @@
'use strict';
var snipt = {
module: function() {
var modules = {};
module: function() {
var modules = {};
return function(name) {
if (modules[name]) {
return modules[name];
}
return function(name) {
if (modules[name]) {
return modules[name];
}
return modules[name] = {};
};
}()
return modules[name] = {};
};
}()
};
jQuery(function($) {
var SiteView = snipt.module('site').SiteView;
window.site = new SiteView();
var SiteView = snipt.module('site').SiteView;
window.site = new SiteView();
});
// Angular app init.
(function() {
var root = this;
var root = this;
// App definition.
var app = angular.module('Snipt', [], function($locationProvider) {
$locationProvider.html5Mode(true);
});
// App definition.
var app = angular.module('Snipt', ['ngRoute'], function($locationProvider) {
$locationProvider.html5Mode(true);
});
// Use non-Django-style interpolation.
app.config(function($interpolateProvider) {
$interpolateProvider.startSymbol('{[{');
$interpolateProvider.endSymbol('}]}');
});
// Use non-Django-style interpolation.
app.config(function($interpolateProvider) {
$interpolateProvider.startSymbol('{[{');
$interpolateProvider.endSymbol('}]}');
});
root.app = app;
root.app = app;
if (root.user_id) {
root.mixpanel.identify(root.user_id);
root.mixpanel.alias(root.user);
root.mixpanel.people.set({
$name: root.user,
$username: root.user,
$email: root.user_email,
$ip: root.user_ip
});
}
app.controller('AppController', function($scope) {
$scope.ads = [
{
url: 'http://showroom.is/?from=snipt',
image: '/static/img/logo-showroom.png',
company: 'Showroom.is',
title: 'New-car research for the modern web.'
},
{
url: 'http://showroom.is/?from=snipt',
image: '/static/img/logo-showroom.png',
company: 'Showroom.is',
title: 'New-car research for the modern web.'
},
{
url: 'http://showroom.is/?from=snipt',
image: '/static/img/logo-showroom.png',
company: 'Showroom.is',
title: 'New-car research for the modern web.'
},
{
url: 'http://showroom.is/?from=snipt',
image: '/static/img/logo-showroom.png',
company: 'Showroom.is',
title: 'New-car research for the modern web.'
},
{
url: 'http://showroom.is/?from=snipt',
image: '/static/img/logo-showroom.png',
company: 'Showroom.is',
title: 'New-car research for the modern web.'
},
{
url: 'http://showroom.is/?from=snipt',
image: '/static/img/logo-showroom.png',
company: 'Showroom.is',
title: 'New-car research for the modern web.'
},
{
url: 'http://showroom.is/?from=snipt',
image: '/static/img/logo-showroom.png',
company: 'Showroom.is',
title: 'New-car research for the modern web.'
},
{
url: 'http://showroom.is/?from=snipt',
image: '/static/img/logo-showroom.png',
company: 'Showroom.is',
title: 'New-car research for the modern web.'
},
{
url: 'http://showroom.is/?from=snipt',
image: '/static/img/logo-showroom.png',
company: 'Showroom.is',
title: 'New-car research for the modern web.'
},
{
url: 'http://showroom.is/?from=snipt',
image: '/static/img/logo-showroom.png',
company: 'Showroom.is',
title: 'New-car research for the modern web.'
},
{
url: 'http://showroom.is/?from=snipt',
image: '/static/img/logo-showroom.png',
company: 'Showroom.is',
title: 'New-car research for the modern web.'
},
{
url: 'http://showroom.is/?from=snipt',
image: '/static/img/logo-showroom.png',
company: 'Showroom.is',
title: 'New-car research for the modern web.'
},
{
url: 'http://showroom.is/?from=snipt',
image: '/static/img/logo-showroom.png',
company: 'Showroom.is',
title: 'New-car research for the modern web.'
},
{
url: 'http://showroom.is/?from=snipt',
image: '/static/img/logo-showroom.png',
company: 'Showroom.is',
title: 'New-car research for the modern web.'
},
{
url: 'http://showroom.is/?from=snipt',
image: '/static/img/logo-showroom.png',
company: 'Showroom.is',
title: 'New-car research for the modern web.'
},
{
url: 'http://bruce-springsteen-the-e-street-band.gigs.is/?from=snipt',
image: 'http://cdn.chairnerd.com/images/performers-landscape/bruce-springsteen-bf99a8/4275/huge.jpg',
company: 'Gigs.is',
title: 'Bruce Springsteen & The E Street Band on tour.'
},
{
url: 'http://beyonce.gigs.is/?from=snipt',
image: 'http://cdn.chairnerd.com/images/performers-landscape/beyonce-b28ec9/37/huge.jpg',
company: 'Gigs.is',
title: 'Beyonce on tour. View current tour dates on:'
},
{
url: 'http://paul-mccartney.gigs.is/?from=snipt',
image: 'http://cdn.chairnerd.com/images/performers-landscape/paul-mccartney-0ab8df/1408/huge.jpg',
company: 'Gigs.is',
title: 'Paul McCartney on tour. View current tour dates on:'
},
{
url: 'http://rolling-stones.gigs.is/?from=snipt',
image: 'http://cdn.chairnerd.com/images/performers-landscape/rolling-stones-73ab94/2597/huge.jpg',
company: 'Gigs.is',
title: 'Rolling Stones on tour. View current tour dates on:'
},
{
url: 'http://justin-timberlake.gigs.is/?from=snipt',
image: 'http://cdn.chairnerd.com/images/performers-landscape/justin-timberlake-c30b82/1019/huge.jpg',
company: 'Gigs.is',
title: 'Justin Timberlake on tour. View current tour dates on:'
},
{
url: 'http://billy-joel.gigs.is/?from=snipt',
image: 'http://cdn.chairnerd.com/images/performers-landscape/billy-joel-254023/303/huge.jpg',
company: 'Gigs.is',
title: 'Billy Joel on tour. View current tour dates on:'
},
{
url: 'http://taylor-swift.gigs.is/?from=snipt',
image: 'http://cdn.chairnerd.com/images/performers-landscape/taylor-swift-1cdf83/35/huge.jpg',
company: 'Gigs.is',
title: 'Taylor Swift on tour. View current tour dates on:'
},
{
url: 'http://one-direction.gigs.is/?from=snipt',
image: 'http://cdn.chairnerd.com/images/performers-landscape/one-direction-a22937/12586/huge.jpg',
company: 'Gigs.is',
title: 'One Direction on tour. View current tour dates on:'
},
{
url: 'http://george-strait.gigs.is/?from=snipt',
image: 'http://cdn.chairnerd.com/images/performers-landscape/george-strait-92a4b8/780/huge.jpg',
company: 'Gigs.is',
title: 'George Strait on tour. View current tour dates on:'
},
{
url: 'http://pearl-jam.gigs.is/?from=snipt',
image: 'http://cdn.chairnerd.com/images/performers-landscape/pearl-jam-fb4480/1416/huge.jpg',
company: 'Gigs.is',
title: 'Pearl Jam on tour. View current tour dates on:'
}
];
if (root.location.pathname === '/account/stats/') {
root.mixpanel.track('Viewing stats page');
}
if (root.location.pathname === '/pro/') {
root.mixpanel.track('Viewing Pro page');
}
if (root.location.pathname === '/pro/signup/') {
root.mixpanel.track('Viewing Pro signup page');
}
if (root.location.pathname === '/jobs/') {
root.mixpanel.track('Viewing jobs page');
}
root.mixpanel.track_links('#hate-ads', '"Hate ads" link clicked');
root.mixpanel.track_links('#post-job', '"Post a job" link clicked');
root.mixpanel.track_links('a.download', 'Downloading snipt');
app.controller('AppController', function($scope) {
$scope.ads = [
{
url: 'http://showroom.is/?from=snipt',
image: '/static/img/logo-showroom.png',
company: 'Showroom.is',
title: 'New-car research for the modern web.'
},
{
url: 'http://showroom.is/?from=snipt',
image: '/static/img/logo-showroom.png',
company: 'Showroom.is',
title: 'New-car research for the modern web.'
},
{
url: 'http://showroom.is/?from=snipt',
image: '/static/img/logo-showroom.png',
company: 'Showroom.is',
title: 'New-car research for the modern web.'
},
{
url: 'http://showroom.is/?from=snipt',
image: '/static/img/logo-showroom.png',
company: 'Showroom.is',
title: 'New-car research for the modern web.'
},
{
url: 'http://showroom.is/?from=snipt',
image: '/static/img/logo-showroom.png',
company: 'Showroom.is',
title: 'New-car research for the modern web.'
},
{
url: 'http://showroom.is/?from=snipt',
image: '/static/img/logo-showroom.png',
company: 'Showroom.is',
title: 'New-car research for the modern web.'
},
{
url: 'http://showroom.is/?from=snipt',
image: '/static/img/logo-showroom.png',
company: 'Showroom.is',
title: 'New-car research for the modern web.'
},
{
url: 'http://showroom.is/?from=snipt',
image: '/static/img/logo-showroom.png',
company: 'Showroom.is',
title: 'New-car research for the modern web.'
},
{
url: 'http://showroom.is/?from=snipt',
image: '/static/img/logo-showroom.png',
company: 'Showroom.is',
title: 'New-car research for the modern web.'
},
{
url: 'http://showroom.is/?from=snipt',
image: '/static/img/logo-showroom.png',
company: 'Showroom.is',
title: 'New-car research for the modern web.'
},
{
url: 'http://showroom.is/?from=snipt',
image: '/static/img/logo-showroom.png',
company: 'Showroom.is',
title: 'New-car research for the modern web.'
},
{
url: 'http://showroom.is/?from=snipt',
image: '/static/img/logo-showroom.png',
company: 'Showroom.is',
title: 'New-car research for the modern web.'
},
{
url: 'http://showroom.is/?from=snipt',
image: '/static/img/logo-showroom.png',
company: 'Showroom.is',
title: 'New-car research for the modern web.'
},
{
url: 'http://showroom.is/?from=snipt',
image: '/static/img/logo-showroom.png',
company: 'Showroom.is',
title: 'New-car research for the modern web.'
},
{
url: 'http://showroom.is/?from=snipt',
image: '/static/img/logo-showroom.png',
company: 'Showroom.is',
title: 'New-car research for the modern web.'
},
{
url: 'http://bruce-springsteen-the-e-street-band.gigs.is/?from=snipt',
image: 'http://cdn.chairnerd.com/images/performers-landscape/bruce-springsteen-bf99a8/4275/huge.jpg',
company: 'Gigs.is',
title: 'Bruce Springsteen & The E Street Band on tour.'
},
{
url: 'http://beyonce.gigs.is/?from=snipt',
image: 'http://cdn.chairnerd.com/images/performers-landscape/beyonce-b28ec9/37/huge.jpg',
company: 'Gigs.is',
title: 'Beyonce on tour. View current tour dates on:'
},
{
url: 'http://paul-mccartney.gigs.is/?from=snipt',
image: 'http://cdn.chairnerd.com/images/performers-landscape/paul-mccartney-0ab8df/1408/huge.jpg',
company: 'Gigs.is',
title: 'Paul McCartney on tour. View current tour dates on:'
},
{
url: 'http://rolling-stones.gigs.is/?from=snipt',
image: 'http://cdn.chairnerd.com/images/performers-landscape/rolling-stones-73ab94/2597/huge.jpg',
company: 'Gigs.is',
title: 'Rolling Stones on tour. View current tour dates on:'
},
{
url: 'http://justin-timberlake.gigs.is/?from=snipt',
image: 'http://cdn.chairnerd.com/images/performers-landscape/justin-timberlake-c30b82/1019/huge.jpg',
company: 'Gigs.is',
title: 'Justin Timberlake on tour. View current tour dates on:'
},
{
url: 'http://billy-joel.gigs.is/?from=snipt',
image: 'http://cdn.chairnerd.com/images/performers-landscape/billy-joel-254023/303/huge.jpg',
company: 'Gigs.is',
title: 'Billy Joel on tour. View current tour dates on:'
},
{
url: 'http://taylor-swift.gigs.is/?from=snipt',
image: 'http://cdn.chairnerd.com/images/performers-landscape/taylor-swift-1cdf83/35/huge.jpg',
company: 'Gigs.is',
title: 'Taylor Swift on tour. View current tour dates on:'
},
{
url: 'http://one-direction.gigs.is/?from=snipt',
image: 'http://cdn.chairnerd.com/images/performers-landscape/one-direction-a22937/12586/huge.jpg',
company: 'Gigs.is',
title: 'One Direction on tour. View current tour dates on:'
},
{
url: 'http://george-strait.gigs.is/?from=snipt',
image: 'http://cdn.chairnerd.com/images/performers-landscape/george-strait-92a4b8/780/huge.jpg',
company: 'Gigs.is',
title: 'George Strait on tour. View current tour dates on:'
},
{
url: 'http://pearl-jam.gigs.is/?from=snipt',
image: 'http://cdn.chairnerd.com/images/performers-landscape/pearl-jam-fb4480/1416/huge.jpg',
company: 'Gigs.is',
title: 'Pearl Jam on tour. View current tour dates on:'
}
];
var randomIndex = Math.floor(Math.random() * (($scope.ads.length - 1) - 0 + 1)) + 0;
$scope.randomAd = $scope.ads[randomIndex];
});
var randomIndex = Math.floor(Math.random() * (($scope.ads.length - 1) - 0 + 1)) + 0;
$scope.randomAd = $scope.ads[randomIndex];
});
}).call(this);

View File

@ -24,9 +24,6 @@
$http.get('/jobs-json/').then(function(response) {
$scope.jobs = response.data;
$scope.filterJobs();
$timeout(function() {
window.mixpanel.track_links('.job-link', 'Job link clicked');
});
});
$scope.filterJobs = function() {

View File

@ -55,8 +55,6 @@
copy: function() {
window.mixpanel.track('Copying snipt');
$('textarea', this.$copyModal).remove();
window.ui_halted = true;
@ -86,10 +84,6 @@
},
edit: function(adding) {
if (adding !== true) {
window.mixpanel.track('Editing snipt');
}
window.editing = true;
window.ui_halted = true;
@ -261,8 +255,6 @@
},
embed: function() {
window.mixpanel.track('Embedding snipt');
$('textarea', this.$embedModal).remove();
window.ui_halted = true;
@ -322,7 +314,6 @@
success: function() {
that.$el.removeClass('favorited');
that.$favorite.text('Favorite');
window.mixpanel.track('Unfavorited snipt');
},
headers: {
'Authorization': 'ApiKey ' + window.user + ':' + window.api_key
@ -337,7 +328,6 @@
that.$el.addClass('favorited');
that.model.set({'favorite_id': resp.id}, {'silent': true});
that.$favorite.text('Favorited');
window.mixpanel.track('Favorited snipt');
},
headers: {
'Authorization': 'ApiKey ' + window.user + ':' + window.api_key
@ -663,8 +653,6 @@
},
addNewSnipt: function() {
window.mixpanel.track('Adding snipt');
var $articleNewSnipt = $('article#new-snipt');
if ($articleNewSnipt.length === 0) {
@ -672,6 +660,7 @@
var data = {
id: '',
blog_post: false,
code: '',
description: '',
tags: [],
@ -680,6 +669,7 @@
lexer: 'text',
lexer_name: 'Text only',
new_from_js: true,
public: false,
user: {
username: '',
profile: {
@ -687,8 +677,6 @@
}
}
};
data['public'] = false;
data.blog_post = false;
var newSniptView = new Snipt.SniptView({
el: $('article#new-snipt'),

View File

@ -20,11 +20,6 @@
$scope.$root.account = response.data;
$scope.$root.$watch('account.list_view', function(newView, oldView) {
if (oldView !== newView) {
if (newView === 'N') {
window.mixpanel.track('Switched to normal view');
} else {
window.mixpanel.track('Switched to compact view');
}
AccountStorage.saveAccount($scope.$root.account, ['list_view']).then(function(response) {
$scope.$root.account = response.data;
});

View File

@ -37,16 +37,18 @@
</div>
<aside>
<div class="in">
<label class="lexer">
<span>Type</span>
<select name="lexer" id="id_lexer">
{% endverbatim %}
{% for lexer in lexers %}
<option value="{{ lexer.1.0 }}">{{ lexer.0 }}</option>
{% endfor %}
{% verbatim %}
</select>
</label>
<div class="type-lexer">
<label class="lexer type-lexer">
<span>Type</span>
<select name="lexer" id="id_lexer">
{% endverbatim %}
{% for lexer in lexers %}
<option value="{{ lexer.1.0 }}">{{ lexer.0 }}</option>
{% endfor %}
{% verbatim %}
</select>
</label>
</div>
<label class="public is-private">
<input type="checkbox" <% if (snipt.public) { %>checked="checked"<% } %> name="" value="" />
<span>Public</span>

View File

@ -41,7 +41,7 @@
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/highlightjs-themes/tomorrow.css" />
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/blog-themes/default/style.css" />
{% else %}
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/snipt.css?107" />
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/snipt.css?108" />
{% endif %}
{% if has_snipts and not detail %}
@ -65,18 +65,6 @@
<script src="https://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.6/angular.min.js"></script>
<!-- start Mixpanel -->
<script type="text/javascript">
(function(e,b){if(!b.__SV){var a,f,i,g;window.mixpanel=b;a=e.createElement("script");a.type="text/javascript";a.async=!0;a.src=("https:"===e.location.protocol?"https:":"http:")+'//cdn.mxpnl.com/libs/mixpanel-2.2.min.js';f=e.getElementsByTagName("script")[0];f.parentNode.insertBefore(a,f);b._i=[];b.init=function(a,e,d){function f(b,h){var a=h.split(".");2==a.length&&(b=b[a[0]],h=a[1]);b[h]=function(){b.push([h].concat(Array.prototype.slice.call(arguments,0)))}}var c=b;"undefined"!==
typeof d?c=b[d]=[]:d="mixpanel";c.people=c.people||[];c.toString=function(b){var a="mixpanel";"mixpanel"!==d&&(a+="."+d);b||(a+=" (stub)");return a};c.people.toString=function(){return c.toString(1)+".people (stub)"};i="disable track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config people.set people.set_once people.increment people.append people.track_charge people.clear_charges people.delete_user".split(" ");for(g=0;g<i.length;g++)f(c,i[g]);
b._i.push([a,e,d])};b.__SV=1.2}})(document,window.mixpanel||[]);
mixpanel.init("f755aa7068c055698c49ff0307370fa6");
</script>
<!-- end Mixpanel -->
</head>
<body class="{% block body-class %}{% endblock %} {% if request.user.profile.is_pro %}is-pro{% endif %}" ng-controller="AppController">
@ -189,7 +177,7 @@
{% block sub-header %}
<header class="sub">
<div class="inner group">
<ul class="bcrumb">
<ul class="bcrumb group">
<li class="prompt">/</li>
{% block breadcrumb %}{% endblock %}
</ul>
@ -399,6 +387,10 @@
{% endblock %}
{% if debug %}
<script type="text/javascript" src="{{ STATIC_URL }}js/libs/jquery.min.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/libs/jquery-ui.min.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/libs/angular.min.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/libs/angular-route.min.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/libs/underscore.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/libs/json2.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/libs/backbone.js"></script>
@ -415,7 +407,7 @@
<script type="text/javascript" src="{{ STATIC_URL }}js/src/snipts.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/src/search.js"></script>
{% else %}
<script type="text/javascript" src="{{ STATIC_URL }}js/snipt-all.min.js?67"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/snipt-all.min.js?68"></script>
{% endif %}
{% if has_snipts and detail %}