Skip to Main Content

React on RDS Page Change

Left

One

This will begin to make things right. I've traveled too far, and seen too much, to ignore the despair in the galaxy. Without the Jedi, there can be no balance in the Force. Well, because of you now we have a chance. The General's been after this for a long time. The General. Dear child. I see your eyes. You already know the truth. Whomever you're waiting for on Jakku, they're never coming back. But. there's someone who still could. Han Solo? The Rebellion General? No, the smuggler! Wasn't he a war hero?! This is the ship that made the Kessel Run in fourteen parsecs...! Twelve! Fourteen. Hey! Some moof-milker put a compressor on the ignition line! Unkar Plutt did. I thought it was a mistake too, puts too much stress on THE HYPERDRIVE-- -- Stress on the hyperdrive-- Wait! No -- we need your help! My help? This droid has to get to the Resistance base as soon as possible! He's carrying a map to Luke Skywalker. You are the Han Solo that fought with the Rebellion.

Two

We're not clear yet! there's still 30 pallets of cannon shells in C bunker. Forget the ammunition, there's no time. Just get everyone on the transport. Oh no. Come on. Why do you hate it so much? Look closer. My sister and I grew up in a poor mining system. The First Order stripped our ore to finance its military, then shelled us to test their weapons. They took everything we had. And who do you think these people are? There is only one business in the galaxy that'll get you this rich. Forget the ammunition, there's no time. Just get everyone on the transport. Oh no. We've caught them in the middle of their evacuation.

Right

Knockout Model


     
   

Steps

  • Reference KnockoutJS: "#"JET_BASE_DIRECTORY"#"js/libs/knockout/knockout-3.5.1.js
  • Define following JS
// this will hold the model
var viewModel = {};

// check if given element is using the class given
function hasClass(elemID, className) {
  return (' ' + document.getElementById(elemID).className + ' ').indexOf(' ' + className+ ' ') > -1;
}


function initPage () {
  // whenever the RDS is clicked, we check whether the region title should be visible
  // this has the binding defined in the custom attributes: data-bind="class: hideRegionHeader”
  apex.jQuery('.apex-rds').data('onRegionChange', function(mode, activeTab) {
    viewModel.hideRegionHeader(hasClass("SHOW_ALL_tab", 'apex-rds-selected') ? "" : "t-Region--hideHeader");
  });

  // define the model
  viewModel = {
    hideRegionHeader: ko.observable(hasClass("SHOW_ALL_tab", 'apex-rds-selected') ? "" : "t-Region--hideHeader")
  }

  // activate binding with knockout
  ko.applyBindings(viewModel, document.querySelector("html"));
}

  • execute initPage(); onPageLoad
  • define binding on region attribute as needed data-bind="class: hideRegionHeader"