Discounted Ribbon JS Licenses Until Mid-March

Are you planning to purchase a license for Ribbon JS? Now is the time – until mid-March 2015, all licenses are sold at serious discounted price, so get one today.

ribbon.js.scr

Ribbon JS is arguably the best recreation of the MS Officetm ribbon bar, using JavaScript, CSS3, and HTML5. It is a lightweight control, which is ready to use on websites, web-based WYSIWYG editors, sophisticated back-end systems, mail applications, complex file managers, and JavaScript-heavy apps. It has everything you would expect from a ribbon bar – comprehensive and fully documented API, amazing command handling, huge set of inbuilt tools, capability to add custom tools via client-side templates, cool looks and is also available optionally wrapped as a full-blown HTML5 WebComponent. Last but not least, it only takes a few minutes to deploy, configure, and run.

Ribbon JS 4.1.0 is Out

I’ve just released a new minor version for Ribbon JS introducing a couple of new features, properties and methods. The new version is fully backwards compatible with the previous versions of the control (4.0.0 and above), so it is safe to upgrade. The HTML5 Web Component for Ribbon JS has also been updated to support the latest additions.

ribbon.js.scr

Release Notes

  • New highlightTabsGroup method, allowing contextual tab grouping. The method supports custom colors and labels.
  • New unhighlightTabsGroup method, which removes a tab group, set via the highlightTabsGroup method.
  • New enableFlatStyles method, allowing to set flat (Metro) look and feel to the ribbon.
  • New disableFlatStyles method, setting back the classic (pre Office 2013) styles to the ribbon.
  • New appIconUrl property, set in the constructor of a ribbon, allowing custom top left application icon. The property is optional, and the default icon is the HTML5 badge.
  • New flat property (optional, Boolean), set in the constructor of a ribbon. If set to true applies flat (Metro) look and feel to the ribbon. Its default value is false.

Screenshots

ribbonjs.4.1.0

Ribbon JS is arguably the best recreation of the MS Officetm ribbon bar, using JavaScript, CSS3, and HTML5. It is a lightweight control, which is ready to use on websites, web-based WYSIWYG editors, sophisticated back-end systems, mail applications, complex file managers, and JavaScript-heavy apps. It has everything you would expect from a ribbon bar – comprehensive and fully documented API, amazing command handling, huge set of inbuilt tools, capability to add custom tools via client-side templates, cool looks and is also available optionally wrapped as a full-blown HTML5 WebComponent. Last but not least, it only takes a few minutes to deploy, configure, and run.

 

Google AdSense HTML5 Web Component

The HTML5 Web Component for today is a wrapper for Google AdSense ad blocks as a custom tag with a few HTML attributes, methods and accessors.

thumb

Before you Start Using It

  1. This demo page should be deployed on a web server. HTML5 WebComponents do not work from the local file system.
  2. Your ad blocker should be disabled.
  3. You need to be registered with Google AdSense and have a valid client ID for their service.
  4. You need to create ads in Google AdSense.
  5. In the code below replace the client="XX-XXX-XXXXXXXXXXXXXXXX" with your Google AdSense ID (the value of the data-ad-client attribute in the conventional AdSense tag).
  6. In the code below replace the slot="XXXXXXXXXXXX" with your Google AdSense ID (the value of the data-ad-slot attribute in the conventional AdSense tag).
  7. Make sure you are connected to the Internet.
  8. Reload the page to see your ads.
  9. Proceed to the documentation included in the distribution.

Demo and Download

Check and download AcidJs.XAdsByGoogle here.

The HTML

<acidjs-xadsbygoogle width="320" height="100" client="YOUR_ADSENSE_PUBLISHER_ID" slot="SLOT_ID"></acidjs-xadsbygoogle>
<acidjs-xadsbygoogle width="728" height="90" client="YOUR_ADSENSE_PUBLISHER_ID" slot="SLOT_ID"></acidjs-xadsbygoogle>
<acidjs-xadsbygoogle width="300" height="250" client="YOUR_ADSENSE_PUBLISHER_ID" slot="SLOT_ID"></acidjs-xadsbygoogle>

Attributes

Apart from the standard HTML attributes (style, class, id, etc.), the tag also supports the following component-specific attributes:

  • width – Required attribute. Width of the ad block in pixels.
  • height – Required attribute. Height of the ad block in pixels.
  • client – Required attribute. Your AdSense Publisher ID (the value of the data-ad-client attribute in the conventional AdSense tag).
  • slot – Required attribute. AdSense slot ID (the value of the data-ad-slot attribute in the conventional AdSense tag).

How to set/get an attribute:

// JavaScript example
// get
document.querySelector("#ad-01").getAttribute("width");
// set
document.querySelector("#ad-01").setAttribute("width", 200);
// jQuery example
// get
$("#ad-01").attr("width");
// set
$("#ad-01").attr("width", 200);

Accessors

  • config – Gets/sets the DTO of the tag.
// JavaScript getter
document.querySelector("#ad-01").config; // returns {"width": WIDTH, "height": HEIGHT, "client": CLIENT, "slot"": SLOT};
// JavaScript setter
document.querySelector("#ad-01").config = {"width": 200, "height": 200, "client": "ca-pub-4259822914193810", "slot": 1416253888};
// jQuery getter
$("#ad-01").get(0).config; // returns {"width": WIDTH, "height": HEIGHT, "client": CLIENT, "slot"": SLOT}
// jQuery setter
$("#ad-01").get(0).config = {"width": 200, "height": 200, "client": "ca-pub-4259822914193810", "slot": 1416253888}

Methods

All standard JavaScript methods are supported, plus the component-specific:

  • init() – Re(initialize) an ad block.
// JavaScript example
document.querySelector("#ad-01").init();
// jQuery example
$("#ad-01").get(0).init();
  • configure(config) – Set new DTO to the ad block and re-initialize it.
// JavaScript example
document.querySelector("#ad-01").configure({"width": "200", "height": "200", "client": "ca-pub-4259822914193810", "slot": "1416253888"});
// jQuery example
$("#ad-01").get(0).configure({"width": "200", "height": "200", "client": "ca-pub-4259822914193810", "slot": "1416253888"});

If you share the same interest towards HTML5 Web Components as I do these days, make sure you read my relevant blog posts and further endeavors on my HTML5, CSS3 and JavaScript Experiments and Insight website.

Data Dumps from IMDb are now Available Through the IMDb Fetcher API

IMDb Fetcher is an experimental IMDb movie and actors/directors/cast/etc details and search retrieval service I launched in early 2014. In case you don’t want to use the REST API to retrieve IMDb movie and actor data, you can now get data dumps in JSON format, containing several thousand entries.

Here’s a single data dump for a movie and for a name:

Wild at Heart

{
  "status": "success",
  "code": 0,
  "data": {
    "imdbEndPoint": "http://www.imdb.com",
    "imdbId": "tt0100935",
    "title": "Wild at Heart",
    "year": "1990",
    "rating": "7.3",
    "description": "Young lovers Sailor and Lula run from the variety of weirdos that Lula's mom has hired to kill Sailor.",
    "cast": [
      "Nicolas Cage",
      "Laura Dern",
      "Willem Dafoe",
      "J.E. Freeman",
      "Crispin Glover",
      "Diane Ladd",
      "Calvin Lockhart",
      "Isabella Rossellini",
      "Harry Dean Stanton",
      "Grace Zabriskie",
      "Sherilyn Fenn",
      "Marvin Kaplan",
      "William Morgan Sheppard",
      "David Patrick Kelly",
      "Freddie Jones"
    ],
    "imdbUrl": "/title/tt0100935/?ref_=fn_tt_tt_1",
    "country": "USA",
    "releaseDate": "1990-08-17",
    "directors": [
      "David Lynch"
    ],
    "writers": [
      "Barry Gifford",
      "David Lynch"
    ],
    "genres": [
      "Comedy",
      "Crime",
      "Romance"
    ],
    "poster": "[POSTER_URL]",
    "runningTime": "125 min"
  }
}

Clint Eastwood

{
  "status": "success",
  "code": 0,
  "data": {
    "imdbEndPoint": "http:\/\/www.imdb.com",
    "name": "Clint Eastwood",
    "birthDate": "1930-5-31",
    "imdbUrl": "http:\/\/www.imdb.com\/name\/nm0000142\/?ref_=fn_nm_nm_1",
    "bio": "Perhaps the icon of macho movie stars Clint Eastwood has become a standard in international cinema. Born in 1930 in San Francisco the son of a steelworker Eastwood briefly attended Los Angeles City College but dropped out to pursue acting...",
    "knownFor": [
      {
        "title": "Gran Torino (2008)",
        "url": "\/title\/tt1205489\/?ref_=nm_knf_t1"
      },
      {
        "title": "Million Dollar Baby (2004)",
        "url": "\/title\/tt0405159\/?ref_=nm_knf_t2"
      },
      {
        "title": "Erbarmungslos (1992)",
        "url": "\/title\/tt0105695\/?ref_=nm_knf_t3"
      },
      {
        "title": "Cowboys (1959)",
        "url": "\/title\/tt0052504\/?ref_=nm_knf_t4"
      }
    ],
    "photo": "[PHOTO_URL]"
  }
}

Interested? Check this page for details.

Have a great week!

Tic-Tac-Toe Game Recreated as a HTML5 Web Component

Last night I finished my latest experiment in recreating the classic Tic-Tac-Toe game as a HTML5 Web Component. Here’s the result and a few details:

  • Two players take turns on the same computer. The next version will support one player vs. the computer.
  • Game lobby for selecting player names.
  • No images or JavaScript animations, CSS3 stuff only.
  • Small API.
  • Custom events, allowing the game to exchange data on the network or notify/interact by/with other components/controls on the page.
  • Localizable via inline JSON (check the code listing below).
  • Support for 3 board sizes.
  • Allowing multiple instances.

tic.tac.toe

The Markup

<acidjs-xticatactoe x="Martin" o="James"></acidjs-xticatactoe>
<acidjs-xticatactoe debug="true" size="large"></acidjs-xticatactoe>
<acidjs-xticatactoe size="small"></acidjs-xticatactoe>
<acidjs-xticatactoe debug="true">
    <code hidden>
    {
        "yourTurn": "du bist dran!",
        "startNewGame": "Neues Spiel starten",
        "start": "Start!",
        "playerXName": "Spieler X Name",
        "playerOName": "Spieler O Name",
        "choosePlayerXName": "Wählen Sie Name für Spieler X",
        "choosePlayerOName": "Wählen Sie Name für Spieler O",
        "youWin": "Sie gewinnen!",
        "draw": "Unentschieden :("
    }
    </code>
</acidjs-xticatactoe>

HTML Attributes

Apart from the standard HTML attributes (style, class, id, etc.), the tag also supports the following component-specific attributes:

  • x – Optional name for the “x” player. Default: "Tic".
  • o – Optional name for the “o” player. Default: "Tac".
  • debug – Optional. If set to true, the component will output console messages. Default Default: "false".
  • size – Optional size of the board. Default: "medium". Other possible values are "small" and "large".

JavaScript API

All standard JavaScript methods are supported, plus the component-specific:

  • init() – Initialize the game.
  • restart() – Restart the game (an alias of the init() method).
  • destroy() – Destroy the game and remove the board.

Events

The component publishes the following custom events, returning event and game-specific data. The distribution, which could be downloaded from this link contains these event bindings, so you can use your browser’s console to see what data is returned upon firing those events.

  • ttt:ready – Fired when game is ready to play.
  • ttt:win – Fired when game is a win.
  • ttt:draw – Fired when game is a draw.
  • ttt:playing – Fired upon user action.

Enjoy the weekend! If you share the same interest towards HTML5 Web Components as I do these days, make sure you read my relevant blog posts and further endeavors on my HTML5, CSS3 and JavaScript Experiments and Insight website.