Skip to content

Difference between Narrative and LP

rsutormin edited this page Aug 25, 2014 · 1 revision

##Differences between narrative widget and landing page card

There are some differences that should be taken into account when developer creates a widget working in both narrative and landing pages (ui-common project) environment:

  • there is no kbws global variable defined in narrative
  • you can not open new cards by trigger('showXXX', {...}) and you should use window.open(url, '_blank') instead.
  • this list will be extended

So how to detect which environment is around your widget? This code detects resizable LP card:

var card = self.$elem.parent;
var isInResizableCard = $.inArray("ui-resizable", card.attr('class').split(/\s+/));

This is for narrative detection:

var notebookContainer = $('#notebook-container');
var isInNarrative = typeof notebookContainer != 'undefined';

If both these variables are false then your widget is more likely part of non resizable landing page layout.

Clone this wiki locally