Merge branch 'master' into feat/express4

* master: (29 commits)
  3.41.10
  fix: smaller line numbers
  3.41.9
  fix: minor display annoyances
  3.41.8
  chore: typo
  fix: try to get jsbin to build again in prod
  3.41.7
  🐛fixed deletion bug while using sqlite (#2963)
  Update libraries.js (#2949)
  3.41.6
  fix: always use given country when testing VAT
  3.41.5
  fix: move to taxtools
  3.41.4
  fix: country code for greece (EL not GR)
  3.41.3
  chore: tweak title
  3.41.2
  fix
  ...
This commit is contained in:
Remy Sharp 2017-04-22 15:30:01 +01:00
commit d670dc61ad
18 changed files with 181 additions and 279 deletions

View File

@ -593,7 +593,7 @@ module.exports = utils.inherit(Object, {
function updateMultipleFields(sqlTemplate, columnsArray) {
return function (bin, params, fn) {
return function (args, params, fn) {
var values = [];
var queries = Object.keys(params).map(function(key) {
if (columnsArray.indexOf(key) === -1) {
@ -603,8 +603,7 @@ function updateMultipleFields(sqlTemplate, columnsArray) {
return '`' + key + '`=?';
});
values.push(bin.url);
values.push(bin.revision);
values = values.concat(args);
var sql = sqlTemplate.replace('`:field`=?', queries.join(', '));

View File

@ -965,7 +965,7 @@ module.exports = Observable.extend({
});
// only expose the parts of the user we want
var userfields = 'avatar name bincount created pro settings';
var userfields = 'avatar name bincount created pro settings github_token';
jsbin.user = _.pick.apply(_, [user].concat(userfields.split(' ')));
if (!jsbin.user.avatar && req.session.user) {
@ -1299,7 +1299,7 @@ module.exports = Observable.extend({
helpers = this.helpers,
jsbin = JSON.stringify({ version: helpers.production ? helpers.set('version') : 'debug',
root: helpers.url('', true),
static: helpers.urlForStatic()
static: helpers.urlForStatic('', true)
});
@ -1317,7 +1317,7 @@ module.exports = Observable.extend({
} else {
res.render('list', { list_history: html,
jsbin: jsbin,
static: helpers.urlForStatic(),
static: helpers.urlForStatic('', true),
scripts: [ '/js/vendor/jquery-1.11.0.min.js',
'/js/vendor/pretty-date.js',
'/js/render/saved-history-preview.js'

View File

@ -14,8 +14,8 @@ oembed.embed = function(req, res, next) {
var embedUrl = url.replace(/\/edit\b/, '/embed');
var callback = req.query.callback;
var width = req.query.maxwidth || 640;
var height = req.query.maxheight || 480;
var width = req.query.maxwidth || 320;
var height = req.query.maxheight || 240;
var oembed = {
type: 'rich',

View File

@ -671,10 +671,21 @@ function mountRouter(expressApp) {
json: true,
}, function (error, response, body) {
if (error || response.statusCode !== 200) {
console.log(error);
return res.end();
}
res.render('inject-ad.js.html', { layout: false, ad: body.ads[0] });
var ad = body.ads.filter(function (ad) {
return !!ad.active;
}).shift();
var pixels = (ad.pixel || '').split('||');
var time = Math.round(Date.now() / 10000) | 0;
var imgs = pixels.map(function (pixel) {
return '<img src="' + pixel.replace('[timestamp]', time) + '" height=1 width=1 border=0 style="display:none">';
});
res.render('inject-ad.js.html', { layout: false, ad: ad, imgs: imgs });
})
});

View File

@ -13,13 +13,17 @@ function getVATByCountry(countrycode) {
}
function countryIsInEU(countrycode) {
var EU = ['AT', 'BE', 'BG', 'CY', 'CZ', 'DE', 'DK', 'EE', 'EL', 'ES', 'FI', 'FR', 'GB', 'HR', 'HU', 'IE', 'IT', 'LT', 'LU', 'LV', 'MT', 'NL', 'PL', 'PT', 'RO', 'SE', 'SI', 'SK'];
var EU = ['AT', 'BE', 'BG', 'CY', 'CZ', 'DE', 'DK', 'EE', 'EL', 'GR', 'ES', 'FI', 'FR', 'GB', 'HR', 'HU', 'IE', 'IT', 'LT', 'LU', 'LV', 'MT', 'NL', 'PL', 'PT', 'RO', 'SE', 'SI', 'SK'];
return EU.indexOf((countrycode||'').toUpperCase()) !== -1;
}
function getCountry(customer) {
var card = customer.default_card; // jshint ignore:line
if (customer.metadata.country && customer.metadata.vat) { // this comes from the VATIN
return customer.metadata.country.toUpperCase();
}
var country = customer.cards.data.reduce(function (last, current) {
if (current.id === card) {
return current.country;

View File

@ -1,256 +1,90 @@
{
"last_updated": "2016-01-01T22:34Z",
"disclaimer": "This data is compiled from official European Commission sources to be as accurate as possible, however no guarantee of accuracy is provided. Use at your own risk. Don't trust random people on the internet without doing your own research.",
"rates": {
"AT": {
"country": "Austria",
"standard_rate": 20.00,
"reduced_rate": 10.00,
"reduced_rate_alt": 13.00,
"super_reduced_rate": false,
"parking_rate": 12.00
},
"BE": {
"country": "Belgium",
"standard_rate": 21.00,
"reduced_rate": 12.00,
"reduced_rate_alt": 6.00,
"super_reduced_rate": false,
"parking_rate": 12.00
},
"BG": {
"country": "Bulgaria",
"standard_rate": 20.00,
"reduced_rate": 9.00,
"reduced_rate_alt": false,
"super_reduced_rate": false,
"parking_rate": false
},
"CY": {
"country": "Cyprus",
"standard_rate": 19.00,
"reduced_rate": 9.00,
"reduced_rate_alt": 5.00,
"super_reduced_rate": false,
"parking_rate": false
},
"CZ": {
"country": "Czech Republic",
"standard_rate": 21.00,
"reduced_rate": 15.00,
"reduced_rate_alt": 10.00,
"super_reduced_rate": false,
"parking_rate": false
},
"DK": {
"country": "Denmark",
"standard_rate": 25.00,
"reduced_rate": false,
"reduced_rate_alt": false,
"super_reduced_rate": false,
"parking_rate": false
},
"DE": {
"country": "Germany",
"standard_rate": 19.00,
"reduced_rate": 7.00,
"reduced_rate_alt": false,
"super_reduced_rate": false,
"parking_rate": false
},
"EE": {
"country": "Estonia",
"standard_rate": 20.00,
"reduced_rate": 9.00,
"reduced_rate_alt": false,
"super_reduced_rate": false,
"parking_rate": false
},
"EL": {
"_comment": "While the EU uses the country code 'EL' for Greece, ISO uses 'GR' - both are included for convenience.",
"iso_duplicate": "GR",
"country": "Greece",
"standard_rate": 23.00,
"reduced_rate": 13.00,
"reduced_rate_alt": 6.00,
"super_reduced_rate": false,
"parking_rate": false
},
"GR": {
"_comment": "Duplicate of EL for convenience; the EU uses the country code 'EL' for Greece, while ISO uses 'GR'.",
"iso_duplicate_of": "EL",
"country": "Greece",
"standard_rate": 23.00,
"reduced_rate": 13.00,
"reduced_rate_alt": 6.00,
"super_reduced_rate": false,
"parking_rate": false
},
"ES": {
"country": "Spain",
"standard_rate": 21.00,
"reduced_rate": 10.00,
"reduced_rate_alt": false,
"super_reduced_rate": 4.00,
"parking_rate": false
},
"FI": {
"country": "Finland",
"standard_rate": 24.00,
"reduced_rate": 14.00,
"reduced_rate_alt": 10.00,
"super_reduced_rate": false,
"parking_rate": false
},
"FR": {
"country": "France",
"standard_rate": 20.00,
"reduced_rate": 10.00,
"reduced_rate_alt": 5.50,
"super_reduced_rate": 2.10,
"parking_rate": false
},
"HR": {
"country": "Croatia",
"standard_rate": 25.00,
"reduced_rate": 13.00,
"reduced_rate_alt": 5.00,
"super_reduced_rate": false,
"parking_rate": false
},
"IT": {
"country": "Italy",
"standard_rate": 22.00,
"reduced_rate": 10.00,
"reduced_rate_alt": 4.00,
"super_reduced_rate": false,
"parking_rate": false
},
"LV": {
"country": "Latvia",
"standard_rate": 21.00,
"reduced_rate": 12.00,
"reduced_rate_alt": false,
"super_reduced_rate": false,
"parking_rate": false
},
"LT": {
"country": "Lithuania",
"standard_rate": 21.00,
"reduced_rate": 9.00,
"reduced_rate_alt": 5.00,
"super_reduced_rate": false,
"parking_rate": false
},
"LU": {
"country": "Luxembourg",
"standard_rate": 17.00,
"reduced_rate": 14.00,
"reduced_rate_alt": 8.00,
"super_reduced_rate": 3.00,
"parking_rate": 12.00
},
"HU": {
"country": "Hungary",
"standard_rate": 27.00,
"reduced_rate": 18.00,
"reduced_rate_alt": 5.00,
"super_reduced_rate": false,
"parking_rate": false
},
"IE": {
"country": "Ireland",
"standard_rate": 23.00,
"reduced_rate": 13.50,
"reduced_rate_alt": 9.00,
"super_reduced_rate": 4.80,
"parking_rate": 13.50
},
"MT": {
"country": "Malta",
"standard_rate": 18.00,
"reduced_rate": 7.00,
"reduced_rate_alt": 5.00,
"super_reduced_rate": false,
"parking_rate": false
},
"NL": {
"country": "Netherlands",
"standard_rate": 21.00,
"reduced_rate": 6.00,
"reduced_rate_alt": false,
"super_reduced_rate": false,
"parking_rate": false
},
"PL": {
"country": "Poland",
"standard_rate": 23.00,
"reduced_rate": 8.00,
"reduced_rate_alt": 5.00,
"super_reduced_rate": false,
"parking_rate": false
},
"PT": {
"country": "Portugal",
"standard_rate": 23.00,
"reduced_rate": 13.00,
"reduced_rate_alt": 6.00,
"super_reduced_rate": false,
"parking_rate": 13.00
},
"RO": {
"country": "Romania",
"standard_rate": 20.00,
"reduced_rate": 9.00,
"reduced_rate_alt": 5.00,
"super_reduced_rate": false,
"parking_rate": false
},
"SI": {
"country": "Slovenia",
"standard_rate": 22.00,
"reduced_rate": 9.50,
"reduced_rate_alt": false,
"super_reduced_rate": false,
"parking_rate": false
},
"SK": {
"country": "Slovakia",
"standard_rate": 20.00,
"reduced_rate": 10.00,
"reduced_rate_alt": false,
"super_reduced_rate": false,
"parking_rate": false
},
"SE": {
"country": "Sweden",
"standard_rate": 25.00,
"reduced_rate": 12.00,
"reduced_rate_alt": 6.00,
"super_reduced_rate": false,
"parking_rate": false
},
"UK": {
"_comment": "While the EU uses the country code 'UK' for the United Kingdom, ISO uses 'GB' - both are included for convenience.",
"iso_duplicate": "GB",
"country": "United Kingdom",
"standard_rate": 20.00,
"reduced_rate": 5.00,
"reduced_rate_alt": false,
"super_reduced_rate": false,
"parking_rate": false
},
"GB": {
"_comment": "Duplicate of GB for convenience; the EU uses the country code 'UK' for the United Kingdom, while ISO uses 'GB'.",
"iso_duplicate_of": "UK",
"country": "United Kingdom",
"standard_rate": 20.00,
"reduced_rate": 5.00,
"reduced_rate_alt": false,
"super_reduced_rate": false,
"parking_rate": false
}
"last_updated": "2017-01-27",
"notes": "generated using @remy/eu-tax-rates/lib/convert.js",
"rates": {
"AT": {
"standard_rate": 20
},
"BE": {
"standard_rate": 21
},
"BG": {
"standard_rate": 20
},
"CY": {
"standard_rate": 19
},
"CZ": {
"standard_rate": 21
},
"DE": {
"standard_rate": 19
},
"DK": {
"standard_rate": 25
},
"EE": {
"standard_rate": 20
},
"ES": {
"standard_rate": 21
},
"FI": {
"standard_rate": 24
},
"FR": {
"standard_rate": 20
},
"GB": {
"standard_rate": 20
},
"GR": {
"standard_rate": 24
},
"HR": {
"standard_rate": 25
},
"HU": {
"standard_rate": 27
},
"IE": {
"standard_rate": 23
},
"IT": {
"standard_rate": 22
},
"LT": {
"standard_rate": 21
},
"LU": {
"standard_rate": 17
},
"LV": {
"standard_rate": 21
},
"MT": {
"standard_rate": 18
},
"NL": {
"standard_rate": 21
},
"PL": {
"standard_rate": 23
},
"PT": {
"standard_rate": 23
},
"RO": {
"standard_rate": 19
},
"SE": {
"standard_rate": 25
},
"SI": {
"standard_rate": 22
},
"SK": {
"standard_rate": 20
}
}
}

View File

@ -9,7 +9,7 @@
"name": "jsbin",
"description": "Collaborative JavaScript Debugging App",
"main": "./lib/app",
"version": "3.40.3",
"version": "3.41.10",
"preferGlobal": "true",
"homepage": "http://jsbin.com",
"bin": "./bin/jsbin",
@ -23,6 +23,7 @@
"build": "grunt build",
":install": "build/install.js",
"postinstall": "grunt build",
"// disabled": " && npm run selenium:install",
"postversion": "git push origin master && git push --tags origin master",
"_preupdate": "node build/pre-update.js",
"_postupdate": "node build/post-update.js commit",

View File

@ -1653,6 +1653,10 @@ li.CodeMirror-hint-active {
padding-left: 0;
}
.CodeMirror-linenumber {
font-size: 12px;
}
#jsbin .CodeMirror-Tern-tooltip,
#jsbin .CodeMirror-hints {
border: 1px solid #aaa;
@ -2364,6 +2368,8 @@ left: 50%;
width: 100px;
padding-left: 20px;
padding-right: 20px;
overflow: hidden;
text-overflow: ellipsis;
}
#history .url .snapshot {
@ -2429,7 +2435,9 @@ left: 50%;
/* Archive */
/* By default, don't show archived rows */
#history tr.archived {
#history tr.archived,
#history tr.archived + tr.spacer
{
display: none;
}
@ -4802,3 +4810,7 @@ body.min #bin .editbox .CodeMirror pre {
#bsaapi a:hover {
color: inherit;
}
.fadeout {
color: #ccc;
}

View File

@ -890,3 +890,8 @@ input.invalid {
small {
font-size: smaller;
}
.fadeout,
.fadeout a {
color: #ccc;
}

View File

@ -145,11 +145,12 @@ jQuery(function ($) {
if (vatNum) {
vatEl.addClass('validating');
$.getJSON('//vat-validator.herokuapp.com/' + vat + '?callback=?', function (data) {
if (data.error) {
$.getJSON('https://taxtools.io/api/validate/' + vat, function (data) {
if (!data.verified) {
return setTimeout(function () {
console.log('API request failed, trying again');
$('#validateVat').click();
}, 2000);
}, 3000);
}
if (data) {

View File

@ -647,9 +647,9 @@ var libraries = [
},
{
'url':[
'https://cdnjs.cloudflare.com/ajax/libs/three.js/r72/three.min.js'
'https://cdnjs.cloudflare.com/ajax/libs/three.js/r82/three.min.js'
],
'label': 'Three.js r72'
'label': 'Three.js r82'
},
{
'url':[
@ -684,10 +684,10 @@ var libraries = [
'url': {
'url': 'https://openui5.hana.ondemand.com/resources/sap-ui-core.js',
'id': 'sap-ui-bootstrap',
'data-sap-ui-theme': 'sap_bluecrystal',
'data-sap-ui-theme': 'sap_belize',
'data-sap-ui-libs': 'sap.m'
},
'label': 'OpenUI5 latest (Mobile BlueCrystal)'
'label': 'OpenUI5 CDN (belize Theme, mobile library)'
},
{
'url': 'https://cdnjs.cloudflare.com/ajax/libs/gsap/1.11.7/TweenMax.min.js',
@ -734,14 +734,14 @@ var libraries = [
},
{
'url': [
'https://unpkg.com/blaze',
'https://unpkg.com/blaze/dist/blaze.min.css',
'https://unpkg.com/blaze/dist/blaze.colors.min.css'
],
'label': 'Blaze CSS (latest)'
},
{
'url': 'https://unpkg.com/@reactivex/rxjs@5.0.0-beta.7/dist/global/Rx.umd.js',
'label': 'RxJS 5.0.0-beta.7',
'url': 'https://unpkg.com/@reactivex/rxjs@5.0.3/dist/global/Rx.js',
'label': 'RxJS 5.0.3',
'group': 'RxJS'
},
{

View File

@ -132,7 +132,7 @@ function exposeSettings() {
if (isDOM(window.jsbin) || !window.jsbin || !window.jsbin.state) { // because...STUPIDITY!!!
window.jsbin = {
user: window.jsbin.user,
user: $.extend(true, {}, window.jsbin.user, jsbin.user),
'static': jsbin['static'],
version: jsbin.version,
analytics: jsbin.analytics,

View File

@ -266,6 +266,17 @@ window._console = {
clear: function () {
output.innerHTML = '';
},
assert: function() {
if (arguments.length === 0 || !eval(arguments[0])) {
var msg = [];
for(var p in arguments) {
if (p === "0") continue;
msg.push(arguments[p]);
}
var assertionMsg = msg.join(' ') || 'console.assert'
log('Assertion failed: '+assertionMsg, 'error');
}
},
log: function () {
var l = arguments.length, i = 0;
for (; i < l; i++) {

View File

@ -35,6 +35,23 @@
<meta property="og:description" content="A live pastebin for HTML, CSS & JavaScript and a range of processors, including SCSS, CoffeeScript, Jade and more..." />
{{/if}}
<meta property="og:image" content="{{static}}/images/logo.png" />
<script>
window['_fs_debug'] = false;
window['_fs_host'] = 'www.fullstory.com';
window['_fs_org'] = '41ZXJ';
window['_fs_namespace'] = 'FS';
(function(m,n,e,t,l,o,g,y){
if (e in m && m.console && m.console.log) { m.console.log('FullStory namespace conflict. Please set window["_fs_namespace"].'); return;}
g=m[e]=function(a,b){g.q?g.q.push([a,b]):g._api(a,b);};g.q=[];
o=n.createElement(t);o.async=1;o.src='https://'+_fs_host+'/s/fs.js';
y=n.getElementsByTagName(t)[0];y.parentNode.insertBefore(o,y);
g.identify=function(i,v){g(l,{uid:i});if(v)g(l,v)};g.setUserVars=function(v){g(l,v)};
g.identifyAccount=function(i,v){o='account';v=v||{};v.acctId=i;g(o,v)};
g.clearUserCookie=function(c,d,i){if(!c || document.cookie.match('fs_uid=[`;`]*`[`;`]*`[`;`]*`')){
d=n.domain;while(1){n.cookie='fs_uid=;domain='+d+
';path=/;expires='+new Date(0).toUTCString();i=d.indexOf('.');if(i<0)break;d=d.slice(i+1)}}};
})(window,document,window['_fs_namespace'],'script','user');
</script>
</head>
<!--[if lt IE 7]> <body class="source ie ie6"> <![endif]-->
<!--[if IE 7]> <body class="source ie ie7"> <![endif]-->

View File

@ -1,4 +1,4 @@
document.getElementById('bsaapi').innerHTML = '<a href="{{ad.statlink}}" target="_blank">{{ad.description}}</a>{{#if ad.pixel}}<img src="{{ad.pixel}}">{{/if}}';
document.getElementById('bsaapi').innerHTML = '<a href="{{ad.statlink}}" target="_blank">{{ad.title}}: {{ad.description}}</a>{{#each imgs}}{{{.}}}{{/each}}';
{{#if ad.description}}$('body').addClass('bsaapi');{{/if}}
$('#bsaapi a').click(function () {
jsbin.analytics.track('ad', 'click', 'bsa');

View File

@ -82,7 +82,7 @@
<option value="de">Germany</option>
<option value="gh">Ghana</option>
<option value="gi">Gibraltar</option>
<option value="gr">Greece</option>
<option value="el">Greece</option>
<option value="gl">Greenland</option>
<option value="gd">Grenada</option>
<option value="gp">Guadeloupe</option>
@ -242,4 +242,4 @@
<option value="eh">Western Sahara</option>
<option value="ye">Yemen</option>
<option value="zm">Zambia</option>
<option value="zw">Zimbabwe</option>
<option value="zw">Zimbabwe</option>

View File

@ -65,6 +65,7 @@
<button id="validateVat">Check</button>
<br>
</div>
<small class="fadeout">Powered by <a href="https://taxtools.io">taxtools.io</a></small>
</section>

View File

@ -9,6 +9,12 @@ var jsbin = {
(function () {
if (jsbin.user && jsbin.user.name) {
if (window.FS) {
FS.identify(jsbin.user.name, {
displayName: jsbin.user.name,
reviewsWritten_int: 14,
});
}
$('.loggedout').hide();
var menu = $('.loggedin').show();
var html = $('#profile-template').text();