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

@ -15,10 +15,8 @@ var snipt = {
};
jQuery(function($) {
var SiteView = snipt.module('site').SiteView;
window.site = new SiteView();
});
// Angular app init.
@ -27,7 +25,7 @@ jQuery(function($) {
var root = this;
// App definition.
var app = angular.module('Snipt', [], function($locationProvider) {
var app = angular.module('Snipt', ['ngRoute'], function($locationProvider) {
$locationProvider.html5Mode(true);
});
@ -39,34 +37,6 @@ jQuery(function($) {
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
});
}
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 = [
{

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,7 +37,8 @@
</div>
<aside>
<div class="in">
<label class="lexer">
<div class="type-lexer">
<label class="lexer type-lexer">
<span>Type</span>
<select name="lexer" id="id_lexer">
{% endverbatim %}
@ -47,6 +48,7 @@
{% 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 %}