diff --git a/lib/db/sqlite.js b/lib/db/sqlite.js index 2c5ff656..aa697944 100644 --- a/lib/db/sqlite.js +++ b/lib/db/sqlite.js @@ -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(', ')); diff --git a/lib/handlers/bin.js b/lib/handlers/bin.js index ad9a9643..c3234297 100644 --- a/lib/handlers/bin.js +++ b/lib/handlers/bin.js @@ -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' diff --git a/lib/handlers/oembed.js b/lib/handlers/oembed.js index a673518a..d9fd69e3 100644 --- a/lib/handlers/oembed.js +++ b/lib/handlers/oembed.js @@ -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', diff --git a/lib/routes.js b/lib/routes.js index 4838c2d7..cedf1945 100644 --- a/lib/routes.js +++ b/lib/routes.js @@ -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 ''; + }); + + res.render('inject-ad.js.html', { layout: false, ad: ad, imgs: imgs }); }) }); diff --git a/lib/stripe/utils/index.js b/lib/stripe/utils/index.js index 723c216a..054f49a7 100644 --- a/lib/stripe/utils/index.js +++ b/lib/stripe/utils/index.js @@ -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; diff --git a/lib/stripe/utils/vat-rates.json b/lib/stripe/utils/vat-rates.json index b213e51a..29a5d61b 100644 --- a/lib/stripe/utils/vat-rates.json +++ b/lib/stripe/utils/vat-rates.json @@ -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 } + } } diff --git a/package.json b/package.json index cf392462..15e2fa39 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/public/css/style.css b/public/css/style.css index dc39d12d..88f0e6b0 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -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; +} diff --git a/public/css/upgrade.css b/public/css/upgrade.css index 46e65f51..9c8f31a2 100644 --- a/public/css/upgrade.css +++ b/public/css/upgrade.css @@ -890,3 +890,8 @@ input.invalid { small { font-size: smaller; } + +.fadeout, +.fadeout a { + color: #ccc; +} diff --git a/public/js/account/pay.js b/public/js/account/pay.js index feeec3e6..09aecf32 100644 --- a/public/js/account/pay.js +++ b/public/js/account/pay.js @@ -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) { diff --git a/public/js/editors/libraries.js b/public/js/editors/libraries.js index e878035e..50e21f58 100644 --- a/public/js/editors/libraries.js +++ b/public/js/editors/libraries.js @@ -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' }, { diff --git a/public/js/jsbin.js b/public/js/jsbin.js index daeadd5e..de5b0857 100644 --- a/public/js/jsbin.js +++ b/public/js/jsbin.js @@ -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, diff --git a/public/js/render/console.js b/public/js/render/console.js index ff0c77a6..35b2f16e 100644 --- a/public/js/render/console.js +++ b/public/js/render/console.js @@ -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++) { diff --git a/views/index.html b/views/index.html index 8e632b32..2d9caaba 100644 --- a/views/index.html +++ b/views/index.html @@ -35,6 +35,23 @@ {{/if}} + diff --git a/views/inject-ad.js.html b/views/inject-ad.js.html index 23f89d6d..1bf27583 100644 --- a/views/inject-ad.js.html +++ b/views/inject-ad.js.html @@ -1,4 +1,4 @@ -document.getElementById('bsaapi').innerHTML = '{{ad.description}}{{#if ad.pixel}}{{/if}}'; +document.getElementById('bsaapi').innerHTML = '{{ad.title}}: {{ad.description}}{{#each imgs}}{{{.}}}{{/each}}'; {{#if ad.description}}$('body').addClass('bsaapi');{{/if}} $('#bsaapi a').click(function () { jsbin.analytics.track('ad', 'click', 'bsa'); diff --git a/views/partials/country.html b/views/partials/country.html index 6df0799e..137ada23 100644 --- a/views/partials/country.html +++ b/views/partials/country.html @@ -82,7 +82,7 @@ - + @@ -242,4 +242,4 @@ - \ No newline at end of file + diff --git a/views/partials/payment.html b/views/partials/payment.html index e16c5287..4bd79e90 100644 --- a/views/partials/payment.html +++ b/views/partials/payment.html @@ -65,6 +65,7 @@
+ Powered by taxtools.io diff --git a/views/user.html b/views/user.html index f625efbd..e004d05e 100644 --- a/views/user.html +++ b/views/user.html @@ -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();