MCPcopy Create free account
hub / github.com/Tampermonkey/tampermonkey / createScriptUsoTab

Function createScriptUsoTab

src/fire.js:670–726  ·  view source on GitHub ↗
(i, tabd, closeEditor)

Source from the content-addressed store, hash-verified

668};
669
670var createScriptUsoTab = function(i, tabd, closeEditor) {
671
672 var tabh = cr('div', i.name, i.id, 'script_editor_h');
673 tabh.textContent = 'USO';
674 var tabc = cr('td', i.name, i.id, 'script_editor_c');
675
676 var container = crc('tr', 'editor_container p100100', i.name, i.id, 'container');
677 var container_menu = crc('tr', '', i.name, i.id, 'container_menu');
678 var container_o = crc('table', 'editor_container_o p100100', i.name, i.id, 'container_o');
679
680 var info_outer = crc('td', 'editor_outer', i.name, i.id, 'script_info');
681 var info = crc('td', 'editor', i.name, i.id, 'script_info');
682 var tab;
683
684 container_o.appendChild(container_menu);
685 container_o.appendChild(container);
686 tabc.appendChild(container_o);
687
688 var menu = crc('td', 'editormenu', i.name, i.id, 'editormenu');
689
690 info_outer.appendChild(info);
691 container.appendChild(info_outer);
692 container_menu.appendChild(menu);
693
694 var i_sc_close = HtmlUtil.createButton(i.name, 'close_script', I18N.getMessage('Close'), closeEditor);
695
696 var install = function() {
697 var cb = function(resp) {
698 if (resp.found) {
699 // if (resp.installed) {}
700 } else {
701 alert(I18N.getMessage("Unable_to_get_UserScript__Sry_"));
702 }
703 }
704 chrome.extension.sendMessage({ method: "scriptClick",
705 url: "http://userscripts.org/scripts/source/" + i['uso:script'] + ".user.js" },
706 cb);
707 };
708
709 var install_button = HtmlUtil.createButton(i.name, 'save', I18N.getMessage('Install'), install);
710
711 menu.appendChild(install_button);
712 menu.appendChild(i_sc_close);
713
714 tab = tabd.appendTab('script_editor_tab' + Helper.createUniqueId(i.name, i.id), tabh, tabc);
715
716 return { onShow: function() {
717 var iframe = document.createElement('iframe');
718 iframe.setAttribute('class', 'script_iframe');
719 iframe.setAttribute('src', "http://greasefire.userscripts.org/scripts/show/" + i['uso:script']);
720 info.innerHTML = '';
721 info.appendChild(iframe);
722 },
723 onClose: function() {
724 }
725 }
726};
727

Callers 1

Calls 2

crFunction · 0.85
crcFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…