Permalink
Browse files

PMC-16265 - Use event to ping ncbi, instead of hard-coded dependency

  • Loading branch information...
Klortho committed Jan 25, 2013
1 parent 2107ae1 commit a85281e51ee89326fab41b560957b10ff6e221f9
Showing with 34 additions and 22 deletions.
  1. BIN img/Thumbs.db
  2. +10 −3 js/jats.reader.js
  3. +24 −19 js/jr.utils.js
  4. BIN test/assets/Thumbs.db
View
Binary file not shown.
View
13 js/jats.reader.js 100755 → 100644
@@ -1,4 +1,4 @@
-/* $Id: jats.reader.js 13234 2012-11-19 15:26:39Z maloneyc $
+/* $Id: jats.reader.js 14142 2013-01-25 21:22:33Z maloneyc $
Module:
Main JATS Reader's application
@@ -42,15 +42,21 @@
}
}(window);
+
/* Main application */
jQuery(document).ready(function () {
var $u = $.jr.utils,
- h = window.location.href;
+ h = window.location.href,
+ $jrContent = $('#jr-content');
try {
if (! ($u.csscolumns) ) {
- console.error("Your browser is not supported. HTML5/CSS3 and ECMAScript, 5th Edition, CSS Multicolumn layout features are required.")
+ console.error("Your browser is not supported. HTML5/CSS3 and ECMAScript, " +
+ "5th Edition, CSS Multicolumn layout features are required.")
+ /* Fire an event for unsupported browser, it relies on
+ csscolumns properties detected by Modernizr */
+ $jrContent.trigger('jr:util:unsupported-browser')
} else {
/* for cases when pixel offsets are not integers next
* function adjust those properties on resize and the domReady time
@@ -222,3 +228,4 @@ jQuery(document).ready(function () {
}
} catch (e) {console.error(e.message)}
});
+
View
43 js/jr.utils.js 100755 → 100644
@@ -1,4 +1,4 @@
-/* $Id: jr.utils.js 13234 2012-11-19 15:26:39Z maloneyc $
+/* $Id: jr.utils.js 14142 2013-01-25 21:22:33Z maloneyc $
Module:
JATS Reader's Utilities via extended jQuery
@@ -64,32 +64,37 @@
$.extend( $.jr.utils, {
//translPattern: 'translate' + ($.jr.utils.csstransforms3d ? '3d' : 'X') + '(@px' + ($.jr.utils.csstransforms3d ? ',0,0)' : ')' ),
+
transl2DPattern: 'translateX(@px)',
+
transl3DPattern: 'translate3d(@px,0,0)',
+
lsSet: function(key, val) {
- if (!!ls) {
- try { // console.info('ls: write key = %s val = %s', key, val)
- ls.removeItem(key) // workaround for iOS devices (some versions)
- ls.setItem(key, val)
- } catch(e) {console.error(e.message)}
- }
+ if (!!ls) {
+ try { // console.info('ls: write key = %s val = %s', key, val)
+ ls.removeItem(key) // workaround for iOS devices (some versions)
+ ls.setItem(key, val)
+ } catch(e) {console.error(e.message)}
+ }
},
+
lsGet: function(key) {
- if (!!ls) {
- try { // console.info('ls: read key = %s val = %s', key, ls.getItem(key))
- var val = ls.getItem(key)
- return !!JSON
- ? (/^(true|false|null)/.test(val)
- ? JSON.parse(val)
- : (val === "undefined" ? undefined : val))
- : val
- } catch(e) {console.error(e.message)}
- }
- return undefined
+ if (!!ls) {
+ try { // console.info('ls: read key = %s val = %s', key, ls.getItem(key))
+ var val = ls.getItem(key)
+ return !!JSON
+ ? (/^(true|false|null)/.test(val)
+ ? JSON.parse(val)
+ : (val === "undefined" ? undefined : val))
+ : val
+ } catch(e) {console.error(e.message)}
+ }
+ return undefined
},
+
jqSafeId: function(id) {
return typeof id === "string" ? id.replace(/(:|\.)/g, '\\$1') : id
- }
+ },
})
})( jQuery );
View
Binary file not shown.

0 comments on commit a85281e

Please sign in to comment.