Tag Archives: JavaScript

How to make Timely’s All-in-One Event Calendar navigation load a new page

A particular web host running IIS 6 did not support the MIME type application/json.  This support was needed because Timely’s All-in-One Event Calendar plugin uses AJAX to perform server requests and returns data in the JSON format.  After frustratingly working with the web host to unsuccessfully apply the MIME type to their server, I decided to change the calendar code to perform a page load rather than use AJAX to load the data.  Here is what I did (This assumes you already have the Standard Calendar version 1.10.9 plugin installed in WordPress version 3.7.1.  I have not tried this with other versions.):

  1. Deactivate the plugin.
  2. Navigate to [Wordpress directory]/wp-content/plugins/all-in-one-event-calendar/app/view/admin/js/scripts.
  3. Rename calendar.js to calendar_ORIGINAL.js.  Just in case you have to revert back.
  4. Open the calendar.js file in your favorite editor.
  5. Copy the obfuscated code, not the comments.
  6. Open a web browser and go to jsbeautifier.org.
  7. Paste the code in the window clearing any existing code first.
  8. Press ctrl-enter to deobfuscate the code.
  9. Copy the code.
  10. Create a new calendar.js file in the [Wordpress directory]/wp-content/plugins/all-in-one-event-calendar/app/view/admin/js/scripts directory.
  11. Paste the code in the new calendar.js file.
  12. Comment out lines 2270 – 2288.  This is where the ajax is called to get the new data.
  13. Add the following code after the commented area: window.location.reload();
  14. Comment out line 2303.  This will allow the default action of the anchors in the calendar to be triggered (in this case navigate to a new page).
  15. Save the file.
  16. Activate the plugin and test the calendar.  When you click a control in the calendar the browser should perform a page load.

JavaScript Array Map and Reduce Methods

The map() method creates a new array with the results of calling a provided function on every element in this array.

Array.prototype.map = function (fn) {
  var l = this.length;
  var a = [];
  for (var i = 0; i < l; i++) {
  return a;

Download this code snippet at GitHubGist JavaScriptArray#map. More info at  MDN Array#map.

The reduce() method applies a function against an accumulator and each value of the array has to reduce it to a single value.

Array.prototype.reduce = function (fn, init) {  
  var s = init;
  var l = this.length;
  for (var i = 0; i < l; i++) {		
    s = fn(s, this[i]);
  return s;

Download this code snippet at GitHubGist JavaScriptArray#reduce.  More info at  MDN Array#reduce.

Lessons Learned at the Rich Web Experience 2008

First I would like to extend kudos to the No Fluff Just Stuff group for putting together an excellent Rich Web Experience symposium.  All who attended had the opportunity to hear from and talk with some of the industry’s best and brightest.

With JavaScript now garnering respect throughout the programming community, it is up to Web developers and designers to help move it forward by promoting innovation (object capability) and solving problems (standards).

So until we can get everyone on the same page and move forward, there are some things we can do to bring out JavaScript’s best:

  • Refactor your code to ensure you are using JavaScript’s good parts.
  • Use existing JavaScript libraries because they have done the dirty work for you.
  • Know that browsers are software built using either incomplete or miscomprehended specs. So don’t get caught up in complaining about what the browser does not do. Start exploiting their good parts.
  • No one ever has time to document the entire code base. So help the open source community by documenting a part of a JavaScript library.
  • There are ways to test JavaScript code (JSSpecJSUnitJSLint).
  • Always remember that to the user the UI is the system. So usability should be very high on your list.