Add in-page JavaScript to inject the Freemius tabs into
the module's setting tabs section.

@author Vova Feldman (@svovaf)
@since  1.2.2.7
969187
function _add_freemius_tabs() {
            $this->_logger->entrance();

            if ( ! $this->should_page_include_tabs() ) {
                return;
            }

            $params = array( 'id' => $this->_module_id );
            fs_require_once_template( 'tabs.php', $params );
        }
169866
function toggleInjectionForActiveTab() {
  var url = tabs.activeTab.url;
  if (!isInjectionEnabledForUrl(url)) {
    enableInjectionForUrl(url);
  } else {
    disableInjectionForUrl(url);
  }
}
909342
def setup(app):
    
    app.add_config_value('sphinx_tabs_nowarn', False, '')
    app.add_config_value('sphinx_tabs_valid_builders', [], '')
    app.add_directive('tabs', TabsDirective)
    app.add_directive('tab', TabDirective)
    app.add_directive('group-tab', GroupTabDirective)
    app.add_directive('code-tab', CodeTabDirective)
    for path in ['sphinx_tabs/' + f for f in FILES]:
        if path.endswith('.css'):
            if 'add_css_file' in dir(app):
                app.add_css_file(path)
            else:
                app.add_stylesheet(path)
        if path.endswith('.js'):
            if 'add_script_file' in dir(app):
                app.add_script_file(path)
            else:
                app.add_javascript(path)
    app.connect('html-page-context', update_context)
    app.connect('build-finished', copy_assets)
698398
function (element) {
/*Line 173 - 'AtomControl.js' */            element.atomControl = this;
/*Line 174 - 'AtomControl.js' */            this._element = element;

/*Line 176 - 'AtomControl.js' */            this.dispatcher = WebAtoms.dispatcher;
/*Line 177 - 'AtomControl.js' */            this.bindings = [];
/*Line 178 - 'AtomControl.js' */            this._isVisible = true;

/*Line 180 - 'AtomControl.js' */            if (element.id && appScope) {
/*Line 181 - 'AtomControl.js' */                appScope[element.id] = this;
/*Line 182 - 'AtomControl.js' */            }
/*Line 183 - 'AtomControl.js' */            AtomUI.assignID(element);

/*Line 185 - 'AtomControl.js' */            allControls[element.id] = this;
/*Line 186 - 'AtomControl.js' */        }
1238799
public function initialise_js(moodle_page $page) {
        foreach ($this->jsyuimodules as $js) {
            $page->requires->yui_module($js->modules, $js->function, $js->arguments, null, $js->ondomready);
        }
        foreach ($this->jsinitcalls as $js) {
            $page->requires->js_init_call($js->function, $js->extraarguments, $js->ondomready, $js->module);
        }
        foreach ($this->jsstrings as $string) {
            $page->requires->strings_for_js($string->identifiers, $string->component, $string->a);
        }
    }
651139
function(items) {
        this.data = items;
        this.items.empty();
        this.tabs.empty();

        for (var li, a, item, i = 0; item = items[i]; i++) {
            li = $('<li/>');
            li.appendTo(this.items);

            a = $('<a/>')
                .attr('href', 'javascript:;')
                .data('showcase-index', i);

            li = $('<li/>');
            li.appendTo(this.tabs).append(a);
        }

        if (items.length <= 1) {
            this.element.addClass('is-single');
        }

        this.fireEvent('load', [items]);
    }
177866
public void contributeToModule() {
		final GuiceModuleAccess module = this.module.get();
		if (!this.removableBindings.isEmpty()) {
			// Ok, we are broking the Java secutiry manager.
			// But it's for having something working!
			try {
				final Field field = module.getClass().getDeclaredField("bindings"); //$NON-NLS-1$
				final boolean accessible = field.isAccessible();
				try {
					field.setAccessible(true);
					final Collection<?> hiddenBindings = (Collection<?>) field.get(module);
					hiddenBindings.removeAll(this.removableBindings);
				} finally {
					field.setAccessible(accessible);
				}
			} catch (Exception exception) {
				throw new IllegalStateException(exception);
			}
		}
		module.addAll(this.bindings);
	}
469498
def insert_tab index, title, config={}, &block
      @tabs.insert(index, Tab.new(title, self, config, &block) )
    end
889716
protected void addModulesList(Collection<ModuleElement> modules, Content tbody) {
        boolean altColor = true;
        for (ModuleElement mdle : modules) {
            if (!mdle.isUnnamed()) {
                Content moduleLinkContent = getModuleLink(mdle, new StringContent(mdle.getQualifiedName().toString()));
                Content thModule = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, moduleLinkContent);
                HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
                tdSummary.addStyle(HtmlStyle.colLast);
                addSummaryComment(mdle, tdSummary);
                HtmlTree tr = HtmlTree.TR(thModule);
                tr.addContent(tdSummary);
                tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
                tbody.addContent(tr);
            }
            altColor = !altColor;
        }
    }
1335489
def insert(self, i, tab_index):
        """"""
        _id = id(self.editor.tabs.widget(tab_index))
        self.history.insert(i, _id)
561130
function manipulatePage(page) {
        if (DEBUG && !page.phantom) inspectArgs("manipulatePage: ", page);

        if (timer !== undefined) {
            clearTimeout(timer);
        }

        // Inject an external script file.
        if (option["javascript-file"]) {
            page.injectJs(option["javascript-file"]);
        }

        // Inject an in-line script from the command line.
        if (option["inject-script"]) {
            var injectScript = option["inject-script"];
            injectScript = (typeof injectScript === "function") ?
                injectScript.toString() : `function() { ${injectScript} }`;
            page.evaluateJavaScript(injectScript);
        }

        if (option.waitcapturedelay) {
            setTimeout(function () { return page }, +option.waitcapturedelay);
        } else {
            return page;
        }
    }
180522
function injectScript() {

    // Creating script element
    var script = document.createElement('script'),
        body = document.getElementsByTagName('body')[0];

    script.src = chrome.extension.getURL('build/artoo.chrome.js');
    script.type = 'text/javascript';
    script.id = 'artoo_injected_script';
    script.setAttribute('chrome', 'true');

    // Appending to body
    body.appendChild(script);
  }
1056129
private function should_page_include_tabs() {
            if ( ! $this->has_settings_menu() ) {
                // Don't add tabs if no settings at all.
                return false;
            }

            if ( ! $this->is_theme() ) {
                // Only add tabs to themes for now.
                return false;
            }

            if ( ! $this->has_paid_plan() && ! $this->has_addons() ) {
                // Only add tabs to monetizing themes.
                return false;
            }

            if ( ! $this->is_theme_settings_page() ) {
                // Only add tabs if browsing one of the theme's setting pages.
                return false;
            }

            if ( $this->is_admin_page( 'pricing' ) && fs_request_get_bool( 'checkout' ) ) {
                // Don't add tabs on checkout page, we want to reduce distractions
                // as much as possible.
                return false;
            }

            return true;
        }
236225
function setupContextMenu() {
  var enableContextMenuItem = contextMenu.Item({
    label: 'Enable For This URL',
    data: 'toggle',
    contentScript:
        "self.on('context', function(node) {" +
        "  var hasWtf = !!document.querySelector('.wtf_a');" +
        "  return !hasWtf ? 'Enable For This URL' : 'Disable For This URL';" +
        "});"
  });
  var resetSettingsContextMenuItem = contextMenu.Item({
    label: 'Reset Settings For This URL',
    data: 'reset'
  });
  var showUiContextMenuItem = contextMenu.Item({
    label: 'Show UI',
    data: 'show_ui'
  });
  var rootContextMenuItem = contextMenu.Menu({
    label: 'Tracing Framework',
    items: [
      enableContextMenuItem,
      resetSettingsContextMenuItem,
      contextMenu.Separator(),
      showUiContextMenuItem
    ],
    contentScript:
        "self.on('click', function(node, data) {" +
        "  self.postMessage(data);" +
        "});",
    onMessage: function(action) {
      switch (action) {
        case 'toggle':
          toggleInjectionForActiveTab();
          break;
        case 'reset':
          resetOptionsForActiveTab();
          break;
        case 'show_ui':
          showUi();
          break;
      }
    }
  });
}
572113
def _add_mermaid_js(self):
        """"""
        self.add_javascripts('{}/js/jquery-1.11.3.min.js'.format(self.resources_path))
        self.add_javascripts('{}/js/mermaid.min.js'.format(self.resources_path))
        self.add_stylesheets('{}/css/mermaid.css'.format(self.resources_path))
        self.main_soup.script.append('mermaid.initialize({startOnLoad:true  });')
688857
function injectStyleTag() {
  if (!styleElement && canUseDOM) {
    styleElement = document.createElement('style');
    document.body.appendChild(styleElement);
    styleElement.setAttribute('class', 'belle-style');
  }
}
881307
function() {

     	var modules = this.modules;
     	for(var i = 0 ; i < modules.length ; i++) {
		  	this.addModuleToList(modules[i]);
     	}

     	// Make the layer a drag drop target
     	if(!this.ddTarget) {
       	this.ddTarget = new YAHOO.util.DDTarget(this.layer.el, "module");
       	this.ddTarget._layer = this.layer;
     	}
 	}