Skip to content

Commit

Permalink
v0.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Cameron Lakenen committed Aug 29, 2014
1 parent e8dbaa5 commit 25c292e
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 16 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@

Viewer.js uses [semantic versioning](http://semver.org/) for its version numbers.


* **0.6.1**
* Simplify and add comments to the presentation transition examples
* Fix [#125](https://github.com/box/viewer.js/issues/125) - Pages are shifted right in IE 7
* Fix [#124](https://github.com/box/viewer.js/issues/124) - JSON is not defined in IE 7
* Remove npm postinstall script
* Fix [#118](https://github.com/box/viewer.js/issues/118) - Error when switching between layouts
* Fix issue with images not showing up in Safari 6
* **0.6.0**
* Add support for common JS `require()` syntax via exports
* **0.5.6**
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "viewer",
"version": "0.6.0",
"version": "0.6.1",
"homepage": "https://github.com/box/viewer.js",
"authors": [
"Cameron Lakenen <lakenen@box.com>",
Expand Down
11 changes: 8 additions & 3 deletions dist/crocodoc.viewer.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! Crocodoc Viewer - v0.6.0 | (c) 2014 Box */
/*! Crocodoc Viewer - v0.6.1 | (c) 2014 Box */

.crocodoc-viewer {
padding:0;
Expand Down Expand Up @@ -74,9 +74,14 @@
/* individual pages */
.crocodoc-page {
display: inline-block;
/* IE7 hack */
/* IE7 hack to force inline behavior on divs */
*display: inline;
zoom: 1;
*zoom: 1;
/* End hack */

/* IE7 inherits text-align: center, which causes the page-content to be shifted */
text-align: left;

vertical-align: middle;
-webkit-user-select: none;
-moz-user-select: none;
Expand Down
71 changes: 65 additions & 6 deletions dist/crocodoc.viewer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! Crocodoc Viewer - v0.6.0 | (c) 2014 Box */
/*! Crocodoc Viewer - v0.6.1 | (c) 2014 Box */

(function (window) {
/*global jQuery*/
Expand Down Expand Up @@ -629,6 +629,8 @@ var Crocodoc = (function () {
* @returns {void}
*/
this.setLayout = function (mode) {
// removing old reference to prevent errors when handling layoutchange message
layout = null;
layout = viewerBase.setLayout(mode);
};

Expand Down Expand Up @@ -1293,7 +1295,8 @@ Crocodoc.addUtility('ajax', function (framework) {
return {
status: status,
statusText: statusText,
responseText: responseText
responseText: responseText,
rawRequest: req
};
}

Expand Down Expand Up @@ -1552,6 +1555,53 @@ Crocodoc.addUtility('ajax', function (framework) {
req.abort();
}
});
},

/**
* Send data to the server. Uses JSON.stringify, so IE 8+.
*
* @param {string} url The url to POST data to
* @param {Object} data A object that will be JSON serialized and sent in the body of the POST
* @returns {$.Promise} A JQuery promise. There is no abort() method because we cannot guarantee
* that an aborted POST has not affected state.
*/
sendJSON: function(url, data) {
var ajax = this,
req,
$deferred = $.Deferred();

function request() {
return ajax.request(url, {
method: 'POST',
data: util.stringifyJSON(data),
headers: [
["Content-Type", "application/json"]
],
success: function() {
if (this.responseText) {
var parsedJSON;
try {
if (this.rawRequest.getResponseHeader('content-type') === 'application/json') {
parsedJSON = util.parseJSON(this.responseText);
$deferred.resolve(parsedJSON);
} else {
$deferred.reject('response not json');
}
} catch (e) {
$deferred.reject('invalid json');
}
} else {
$deferred.reject('empty response');
}
},
fail: function() {
$deferred.reject(this.statusText);
}
});
}

req = request();
return $deferred.promise();
}
};
});
Expand Down Expand Up @@ -1593,6 +1643,10 @@ Crocodoc.addUtility('browser', function () {
browser.chrome = /chrome/i.test(ua);
browser.safari = !browser.chrome;
}
if (browser.safari) {
version = (navigator.appVersion).match(/Version\/(\d+(\.\d+)?)/);
browser.version = version && parseFloat(version[1]);
}

return browser;
});
Expand All @@ -1611,8 +1665,13 @@ Crocodoc.addUtility('common', function () {
util.extend = $.extend;
util.each = $.each;
util.map = $.map;
util.parseJSON = $.parseJSON;
util.param = $.param;
util.parseJSON = $.parseJSON;
util.stringifyJSON = typeof window.JSON !== 'undefined' ?
window.JSON.stringify : // IE 8+
function () {
throw new Error('JSON.stringify not supported');
};

return $.extend(util, {

Expand Down Expand Up @@ -4850,7 +4909,7 @@ Crocodoc.addComponent('page-svg', function (scope) {
}

/**
* Fixes a bug in iOS 6.1 where <use> elements are not supported properly
* Fixes a bug in Safari where <use> elements are not supported properly
* by replacing each <use> element with a clone of its referenced <image>
* @param {Document} contentDocument The SVG document
* @returns {void}
Expand Down Expand Up @@ -4901,9 +4960,9 @@ Crocodoc.addComponent('page-svg', function (scope) {
contentDocument.body.innerHTML = html;
} else {
contentDocument.documentElement.innerHTML = html;
// @NOTE: there is a bug in iOS 6.1 Safari where <use>
// @NOTE: there is a bug in Safari 6 where <use>
// elements don't work properly
if (browser.ios && browser.version < 7) {
if ((browser.ios || browser.safari) && browser.version < 7) {
fixUseElements(contentDocument);
}
}
Expand Down
2 changes: 1 addition & 1 deletion dist/crocodoc.viewer.min.css

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/crocodoc.viewer.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "viewer",
"version": "0.6.0",
"version": "0.6.1",
"description": "A viewer for documents converted with the Box View API",
"author": "Cameron Lakenen <lakenen@box.com>",
"contributors": [
Expand Down

0 comments on commit 25c292e

Please sign in to comment.