Отсутствует
Dumby спасибо разобрался
Отсутствует
Господа форумчане нельзя ли подпраить вот эту кнопку Ночной режим а то что то не работает в однопроцессорном режиме
// ЛКМ переключить настройки кнопки и стиль .......... this._handleClick =()=> setStyleForPages( void(custombuttons.setPrefs(s, !custombuttons.getPrefs(s))) ); // Создать настройки кнопки в about:config если они не существует и получть .......... var s = "CB." + _id.slice(20) + ".setStyleForPage"; custombuttons.isPref(s, false); // Установить нужную иконку кнопки при старте браузера или при изменениях настроек кнопки .......... function toggleImage() { var [img] = document.getAnonymousNodes(self); img.style.backgroundColor = custombuttons.getPrefs(s) ? "#131d24" : "#ffeeaa"; }; toggleImage(); gPrefService.addObserver(s, toggleImage, false); addDestructor(()=> gPrefService.removeObserver(s, toggleImage) ); // Переключить css стиль для страницы .......... function setStyleForPages(reason) { if ( reason == "destructor" ) return; var sss = Cc["@mozilla.org/content/style-sheet-service;1"].getService(Ci.nsIStyleSheetService); var uri = makeURI("data:text/css," + encodeURIComponent(self.getAttribute("Help"))); try { sss.unregisterSheet(Services[_id + "previousUri"] || uri, 0) } catch(e) {}; Services[_id + "-previousUri"] = uri; custombuttons.getPrefs(s) && !reason && sss.loadAndRegisterSheet(uri, 0); }; addDestructor(setStyleForPages); custombuttons.getPrefs(s) && setStyleForPages(); // Подсказка для кнопки .......... this.tooltipText = self.label + "\nЛ: Переключить черный фон страниц";
@-moz-document url-prefix(http://), url-prefix(https://), url-prefix(ftp://), url-prefix(file://), url(about:blank), url-prefix("about:neterror"){ /* Firefox Scrollbars */ scrollbar {opacity: .75 !important;} /* Base */ *, ::before, ::after { color: #CCC !important; border-color: #444 !important; outline-color: #444 !important; text-shadow: none !important; box-shadow: none !important; box-shadow: none !important; background-color: transparent !important; } html * { color: #CCC !important; } p::first-letter, h1::first-letter, h2::first-letter, p::first-line { color: inherit !important; background: none !important; } /* :: Give solid BG :: */ /* element */ html,body, li ul, ul li, table, header, article, section, nav, menu, aside, /* common */ [class*="nav"], [class*="open"], [id*="ropdown"], /*dropdown*/ [class*="ropdown"], div[class*="menu"], [class*="tooltip"], div[class*="popup"], div[id*="popup"], /* Notes, details, etc. Maybe useful */ div[class*="note"], span[class*="note"], div[id*="detail"],div[class*="detail"], div[class*="description"], /* Also common */ div[class*="content"], div[class*="container"], /* Popup divs that use visibility: hidden and display: none */ div[style*="display: block"], div[style*="visibility: visible"] { background-color: #404040 !important; } /*: No BG :*/ *:not(:empty):not(span):not([class="html5-volume-slider html5-draggable"]):not([class="html5-player-chrome html5-stop-propagation"]), *::before, *::after, td:empty, p:empty, div:empty:not([role]):not([style*="flashblock"]):not([class^="html5"]):not([class*="noscriptPlaceholder"]) { background-image: none !important; } /*: Filter non-icons :*/ span:not(:empty):not([class*="icon"]):not([id*="icon"]):not([class*="star"]):not([id*="star"]):not([id*="rating"]):not([class*="rating"]):not([class*="prite"]) { background-image: none !important; text-indent: 0 !important; } /*: Image opacity :*/ img:not([id="mpiv-preview"]), svg { opacity: .75 !important; } img:hover, svg:hover { opacity: 1 !important; } /* Highlight */ ::-moz-selection { background-color: #626F61 !important; color: #F6F7B9 !important; } /* ::: anchor/links ::: */ a { color: #71BAA5 !important; background-color: #696969 !important; opacity: 1 !important; text-indent: 0 !important; } a:link { color: #ACC7F6 !important; } /* hyperlink */ a:visited { color: #CDB4E7 !important; } a:hover { color: #FFE900 !important; background-color: #363037 !important; } a:active { color: #FFAE00 !important; } /* "Top level" div */ body > div { background-color: inherit !important; } /* :::::: Text Presentation :::::: */ summary, details { background-color: inherit !important; } kbd, time, label, .date { color: #B6D2AC !important; } acronym, abbr { border-bottom: 1px dotted !important; cursor: help !important; } mark,code,pre,samp,blockquote { background-color: #282826 !important } /* :::::: Headings :::::: */ h1,h2,h3,h4,h5,h6 { background-image: none !important; border-radius: 5px !important; text-indent: 0 !important; } h1,h2 { background-color: #28313E !important; } h3,h4 { background-color: #2A3731 !important; } h5,h6 { background-color: #372A2A !important; } /* :::::: Tables, cells :::::: */ table table { background: #212121 !important; } th, caption { background: #404040 !important; } /* ::: Inputs, textareas ::: */ input, textarea, button, select, option, optgroup { color: #DDD !important; background: none #404046 !important; -moz-appearance: none !important; } input, textarea, button { border-color: #000 !important; border-width: 1px !important; } /* :::::: Button styling :::::: */ input[type="button"], input[type="submit"], input[type="reset"], button { background: #343855 !important; } input[type="button"]:hover, input[type="submit"]:hover, input[type="reset"]:hover, button:hover { color: #FFF !important; background: #435B6B !important; } input[type="image"] { opacity: .85 !important; } input[type="image"]:hover { opacity: .95 !important; } /* Lightbox fix */ html [id*="lightbox"] * { background-color: transparent !important; } html [id*="lightbox"] img { opacity: 1 !important; } /* Youtube Annotation */ #movie_player-html5 .annotation { background: #333 !important; } /* Mozilla addons shrink/expand sections */ .expando a { background: none transparent !important; } } @-moz-document url(about:newtab) { window { background: #696969 !important; } #newtab-scrollbox { background: transparent none !important; } .newtab-title { background-color: rgba(0,0,0,.75) !important; color: #eee !important; } } @-moz-document url(chrome://browser/content/browser.xul) { /* Browser Background */ browser[type="content-primary"] { background-color: #1a1a1a !important; } }
Отредактировано egorsemenov06 (19-09-2019 01:41:41)
Отсутствует
что то не работает
69
(sss => { var pref = `CB.${_id.slice(20)}.setStyleForPage`; var url = "data:text/css," + encodeURIComponent(this.Help); var args = [Services.io.newURI(url), sss.AGENT_SHEET]; var reg = add => { var has = sss.sheetRegistered(...args); if (add) has || sss.loadAndRegisterSheet(...args); else has && sss.unregisterSheet(...args); } var setState = () => { var state = Services.prefs.getBoolPref(pref, false); this.icon.style.backgroundColor = state ? "#131d24" : "#ffeeaa"; reg(state); } setState(); this._handleClick = () => Services.prefs.setBoolPref( pref, !Services.prefs.getBoolPref(pref, false) ); Services.prefs.addObserver(pref, setState, false); addDestructor(reason => { Services.prefs.removeObserver(pref, setState); reason[5] == "e" && reg(); }); })( Cc["@mozilla.org/content/style-sheet-service;1"] .getService(Ci.nsIStyleSheetService) );
Отсутствует
egorsemenov06 пишетчто то не работает
69
скрытый текстВыделить кодКод:
(sss => { var pref = `CB.${_id.slice(20)}.setStyleForPage`; var url = "data:text/css," + encodeURIComponent(this.Help); var args = [Services.io.newURI(url), sss.AGENT_SHEET]; var reg = add => { var has = sss.sheetRegistered(...args); if (add) has || sss.loadAndRegisterSheet(...args); else has && sss.unregisterSheet(...args); } var setState = () => { var state = Services.prefs.getBoolPref(pref, false); this.icon.style.backgroundColor = state ? "#131d24" : "#ffeeaa"; reg(state); } setState(); this._handleClick = () => Services.prefs.setBoolPref( pref, !Services.prefs.getBoolPref(pref, false) ); Services.prefs.addObserver(pref, setState, false); addDestructor(reason => { Services.prefs.removeObserver(pref, setState); reason[5] == "e" && reg(); }); })( Cc["@mozilla.org/content/style-sheet-service;1"] .getService(Ci.nsIStyleSheetService) );
Спасибо
Отсутствует
Dumby Столкнулся с моментом упорядочить закладки. Был у меня старый скрипт от Alice0775, который он давно забросил - в контекстном меню закладок создавал пункт - Открыть в библиотеке, т.е. открывалось местоположение в библиотеке в развернутом дереве папок. Раньше им давно пользовался. Сейчас естественно не работает.
/*Initialization Code*/ //--------------------- Открыть в бибилиотеке в контекстном меню закладок // @author Alice0775 //https://github.com/alice0775/userChrome.js/blob/master/openLibraryContextMenu.uc.xul (function () { var openLibraryContextMenu = { node: null, organizer: null, get ios() { return Components.classes["@mozilla.org/network/io-service;1"] .getService(Components.interfaces.nsIIOService); }, get bmsvc() { return Components.classes["@mozilla.org/browser/nav-bookmarks-service;1"] .getService(Components.interfaces.nsINavBookmarksService); }, showOrganizer : function () { var view = PlacesUIUtils.getViewForNode(document.popupNode); this.node = view.selectedNode; var wm = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator); this.organizer = wm.getMostRecentWindow("Places:Organizer"); if (!this.organizer) { this.organizer = openDialog("chrome://browser/content/places/places.xul", "", "chrome,toolbar=yes,dialog=no,resizable"); this.organizer.addEventListener("load", this, false); } else { this.selectNode(this.node); } }, getParentFolderByItemId: function(aNode){ var parentFolderId = null; var itemType = PlacesUtils.nodeIsFolder(aNode) || PlacesUtils.nodeIsTagQuery(aNode) ? "folder" : "bookmark"; var concreteId = PlacesUtils.getConcreteItemId(aNode); var isRootItem = PlacesUtils.isRootItem(concreteId); var itemId = aNode.itemId; if (isRootItem || PlacesUtils.nodeIsTagQuery(aNode)) { itemId = concreteId; } parentFolderId = this.bmsvc.getFolderIdForItem(itemId); return parentFolderId; }, selectNode: function(aNode) { var itemType = PlacesUtils.nodeIsFolder(aNode) || PlacesUtils.nodeIsTagQuery(aNode) ? "folder" : "bookmark"; var concreteId = PlacesUtils.getConcreteItemId(aNode); var isRootItem = PlacesUtils.isRootItem(concreteId); var itemId = aNode.itemId; if (isRootItem || PlacesUtils.nodeIsTagQuery(aNode)) { itemId = concreteId; } var isFolder = PlacesUtils.nodeIsFolder(aNode); if (isFolder) { this.selectLeftPane([itemId]); } else if (PlacesUtils.nodeIsQuery(aNode)) { var folderId = aNode.parent.itemId; if (folderId){ this.selectLeftPane([folderId]); } this.selectRightPane([itemId]); } else { var folderId = this.getParentFolderByItemId(aNode); if (folderId){ this.selectLeftPane([folderId]); } this.selectRightPane([itemId]); } setTimeout(function(self){ self.organizer.window.focus(); }, 1, this); }, selectRightPane: function(rightPaneItemIds) { var places = this.organizer.document.getElementById("placeContent"); places.selectItems(rightPaneItemIds, true); var tbo = places.treeBoxObject; tbo.ensureRowIsVisible(places.currentIndex); }, selectLeftPane: function(leftPaneItemIds) { var places = this.organizer.document.getElementById("placesList"); places.selectItems(leftPaneItemIds, true); var tbo = places.treeBoxObject; tbo.ensureRowIsVisible(places.currentIndex); }, selectOnLoad: function() { setTimeout(function(self){ self.selectNode(self.node); }, 1, this); this.organizer.removeEventListener("load", this, false); }, handleEvent: function(event){ switch (event.type){ case 'load': this.selectOnLoad(event); break; } } } if ( document.getElementById("placesContext_manageFolder") ) return; var copyBothMenuItem = document.createXULElement("menuitem"); copyBothMenuItem.id = "placesContext_manageFolder"; copyBothMenuItem.setAttribute("label", "Открыть в библиотеке"); copyBothMenuItem.setAttribute("selection", "bookmark|folder|query|livemark/feedURI"); copyBothMenuItem.setAttribute("closemenu", "single"); copyBothMenuItem.addEventListener("command", function () { openLibraryContextMenu.showOrganizer(); }); var copyMenuItem = document.getElementById("placesContext_openSeparator"); copyMenuItem.parentNode.insertBefore(copyBothMenuItem, copyMenuItem); })();
Отсутствует
накидать новую для многопроцессорного
Вот причём здесь многопроцессность
(popup => addEventListener("popupshowing", { openFoldersInRightPane: false, handleEvent() { if (this.shouldHide) return; var menuitem = document.createXULElement("menuitem"); menuitem.setAttribute("label", "Открыть в библиотеке"); menuitem.setAttribute("oncommand", "openInLibrary();"); menuitem.setAttribute("id", "placesContext_open:library"); popup.querySelector("#placesContext_openSeparator").before(menuitem); addDestructor(() => menuitem.remove()); this.handleEvent = e => e.target == popup && ( menuitem.hidden = menuitem.disabled = this.shouldHide ); menuitem.openInLibrary = () => { var win = Services.wm.getMostRecentWindow("Places:Organizer"); if (win) return win.focus(this.onLibrary(win)); win = openDialog( "chrome://browser/content/places/places.xul", "", "chrome,toolbar=yes,dialog=no,resizable" ); win.addEventListener("pageshow", () => this.onLibrary(win), {once: true}); } }, get shouldHide() { var tn = popup.triggerNode; if (tn.id == "PlacesChevron") return true; var node = tn._placesNode || popup._view.result.root; if (!node) return true; this.data = [ node.bookmarkGuid, node.parent && node.parent.bookmarkGuid, PlacesUtils.nodeIsFolder(node)/* || PlacesUtils.nodeIsQuery(node)*/, node.pageGuid ]; return false; }, async onLibrary(win) { var [guid, parentGuid, isFolder, pageGuid] = this.data; var list = win.document.getElementById("placesList"); var tree = win.document.getElementById("placeContent"); var onlyLeft = isFolder && !this.openFoldersInRightPane; var search = tree.result.root.uri.startsWith("place:terms="); var vRoot = PlacesUtils.virtualAllBookmarksGuid; if (!onlyLeft || search) { if (PlacesUtils.bookmarks.userContentRoots.includes(guid)) parentGuid = vRoot; else if (!parentGuid) parentGuid = (await PlacesUtils.bookmarks.fetch(guid)).parentGuid; } if (search) { var trgGuid = onlyLeft ? guid : parentGuid; if (PlacesUtils.getConcreteItemGuid(list.selectedNode) == trgGuid) list.selectItems([vRoot]); else { var rows = list.view._rows, lastRow = rows[rows.length - 1]; if (lastRow.bookmarkGuid == vRoot) lastRow.containerOpen = true; } } if (onlyLeft) { list.selectItems([guid]); return list.focus(this.scroll(list)); } list.selectItems([parentGuid]); this.scroll(list); if (guid) tree.selectItems([guid]); else if (pageGuid) { var ind = tree.view._rows.findIndex( r => r.pageGuid && r.pageGuid == pageGuid ); if (ind != -1) tree.view.selection.clearSelection(), tree.view.selection.rangedSelect(ind, ind, true); } await new Promise(resolve => setTimeout(resolve, 100)); tree.focus(this.scroll(tree)); }, scroll(tree) { var pos = .35; var visibleRows = tree.getPageLength(); var ind = tree.view.selection.currentIndex; var first = tree.getFirstVisibleRow(); var newFirst = ind - pos*visibleRows + 1; tree.scrollByLines(Math.round(newFirst - first)); } }, false, popup || 1))(document.getElementById("placesContext"));
Отсутствует
Dumby большое спасибо
Отсутствует
Dumby подскажи, вот есть такой код
// добавить страницу в закладки в указанной папке .... function addBookmark(folder, id) { var title = gBrowser.selectedTab.label; var folderId = PlacesUtils.getConcreteItemId(folder); var index = id ? PlacesUtils.bookmarks.getItemIndex(id) + 1 : 0; var readOnlyFolder = PlacesUtils.nodeIsQuery(folder) || PlacesUtils.annotations.itemHasAnnotation(folderId, PlacesUtils.LMANNO_FEEDURI); if ( !readOnlyFolder ) PlacesUtils.bookmarks.insertBookmark(folderId, gBrowser.currentURI, index, title);
Отсутствует
если я нажимаю на штатную кнопку "добавить страницу в закладки", то сохраняется без нумерации
Что мешает посмотреть как это делает браузер?
Вот, цитата из кода PlacesCommandHook.bookmarkPage()
async bookmarkPage() { let browser = gBrowser.selectedBrowser; let url = new URL(browser.currentURI.spec); ..... let isErrorPage = false; if (browser.documentURI) { isErrorPage = /^about:(neterror|certerror|blocked)/.test( browser.documentURI.spec ); } try { if (isErrorPage) { let entry = await PlacesUtils.history.fetch(browser.currentURI); if (entry) { info.title = entry.title; } } else { info.title = browser.contentTitle; } info.title = info.title || url.href;
var tab = gBrowser.selectedTab; tab.textLabel.textContent = "bla"; alert(tab.label);
Отсутствует
Здравствуйте, у всех неподписанные дополнения пашут? вроде бы они пашут но иконок нет, вот CB пашет и другие но иконок(пробовал вызвать через настройки, так окно не разворачивается будто 0px).
Отсутствует
Dumby ради интереса попытался создать кнопку в URL-bar, там где многоточие
if ( document.getElementById("reloadButton") ) return; var icon1="блаблабла"; var reButton = document.createXULElement("toolbarbutton"); reButton.setAttribute("class", "subviewbutton subviewbutton-iconic pageAction-panel-button"); reButton.setAttribute("id", "pageAction-panel-reloadButton"); reButton.setAttribute("label", "Обновить"); reButton.setAttribute("command", "Browser:ReloadOrDuplicate"); reButton.setAttribute("image", icon1); Варианты: 1. const contextMenu = document.getElementById('pageAction-panel-bookmark') contextMenu.parentNode.insertBefore(reButton, contextMenu); 2. const contextMenu = document.getElementById("pageActionPanelMainView"); contextMenu.appendChild( reButton );
Там где многоточие: toolbarbutton [348×24] namespaceURI: XUL margin: 0 border: 0 padding: 4px 12px id = pageAction-panel-copyURL class = subviewbutton subviewbutton-iconic pageAction-panel-button actionid = copyURL label = Копировать ссылку URL-bar: image [24×24] namespaceURI: XUL margin: 0 border: 0 padding: 4px id = pageAction-urlbar-copyURL class = urlbar-icon urlbar-page-action actionid = copyURL aria-label = Копировать ссылку role = button tooltiptext = Копировать ссылку
Отсутствует
Dumby Вы бы не могли пожалуйста, починить эту кнопку для 68 версии, если можно.
https://forum.mozilla-russia.org/viewtopic.php?id=59458
У меня есть похожая, может подойдёт
((popup, {lastChild} = popup, pref = "CB.bookmarkFolderGuidForSaving") => addDestructor(reason => reason == "delete" && Services.prefs.clearUserPref(pref)) + addEventListener("popupshowing", { index: 0, // 0 - первой, PlacesUtils.bookmarks.DEFAULT_INDEX - последней width: 500, height: 640, nodePosition: .35, handleEvent(e) { if (this.shouldHide) return; var menuitem = document.createElementNS(xulns, "menuitem"); menuitem.id = "context-addBookmark"; menuitem.className = "menuitem-iconic"; menuitem.setAttribute("image", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACD0lEQVR42oWTXUhTYRiAP89qziAYepG6TfAiyV1JsFojMJrVjf3dDOsmMoOwCwnSXLSJXgWDqAWBF7aGoFGGV0EUrL9FERoh1bQsqeiXfrzoB0N6es8528ncaC88fOfwnff53vN976eUUprafJk8lPIKS1XRkI8LRVayUVgmLBFsQklBwfhb8rAkRauSidQLDK49/zvqFKmqxBKcn4BzDzBGnU39BVZfTMOxQ6ZIXk6msdh7wUz+9IP/RraaLYYgfAUL73Fz8tJjs5rBh3B2HPrvQ/P+N8TvYJAVdBqCfRcxWH8aYm0dpCIRxvr6SG7bSWLrDsZ6e7ke7SESaiV61UoeFVoMwfYEBrGWNr6NjEAmY5JKmUxPw9QU35NJDq/ekBOcEqoNQSAOnh5Ih0IwPAwJsQ0MSP2DMDTEfDTKV7+f904nN12uBavr/SECZ6dZ1u11Aejqgu5u2ZAwv9vbmfP5mLXZeK0UrzSNGy53bnWXdYw6K47CEX8znwMB5oNBvtTX87G0lA+SmEueqazkYHWdLtgl1OVaybvwfPd41vLI42HGbicjiZPCy7IyntTUcKBqpZ58Iru61dZ6a64RwkJMmGi022dv1dbyrKKCp+XlpOW5yeH4KXPvhMbs3fgndJtDqDJ3VjX4NO3MqNs9J/xapWn3sv/dlJfcGr+rFbijunC5EBQ6hN2C27j6i+IP/uDMhPNYgHUAAAAASUVORK5CYII="); menuitem.setAttribute("oncommand", "linkedObject.oncommand(event);"); menuitem.linkedObject = this; menuitem.oncontextmenu = e => this.pick(e.preventDefault()); lastChild.after(menuitem); addDestructor(() => menuitem.remove()); (this.handleEvent = e => e.target == popup && !(menuitem.hidden = this.shouldHide) && this.update(menuitem) )(e); }, ons: ["isContentSelected", "onTextInput", "onImage", "onVideo", "onCanvas", "onAudio"], get shouldHide() { if (gContextMenu.onLink) return false; return this.ons.some(on => gContextMenu[on]); }, oncommand(e) { this[e.ctrlKey || e.shiftKey ? "pick" : "bookmark"](e.target); }, get guid() { return Services.prefs.getStringPref(pref, PlacesUtils.bookmarks.toolbarGuid); }, async update(menuitem) { var info = await PlacesUtils.bookmarks.fetch(this.guid); var title = PlacesUtils.bookmarks.getLocalizedTitle(info); menuitem.label = "Добавить закладку в: " + ( menuitem.folderName = title || "[без заголовка]" ); }, pick() { var features = "chrome,all,resizable,centerscreen,modal"; window.openDialog(this.url, "_blank", features, this.guid); }, bookmark({folderName}) { if (gContextMenu.onLink) { var url = gContextMenu.linkURL; var title = gContextMenu.linkText(); } else { var url = gBrowser.currentURI.spec; var title = gBrowser.contentTitle || gBrowser.selectedTab.label; } var info = {url, title, parentGuid: this.guid, index: this.index}; PlacesUtils.bookmarks.insert(info).then( () => this.notify(title, "Добавил закладку в папку: " + folderName), err => this.notify("Ошибка", err) ); }, get alert() { var as = this.as = Cc["@mozilla.org/alerts-service;1"] .getService(Ci.nsIAlertsService); this.alertName = _id + "-bookmark-alert"; delete this.alert; return this.alert = as.showAlertNotification .bind(as, "chrome://global/skin/icons/warning.svg"); }, notify(title, msg) { this.alert(title, msg, false, null, null, this.alertName); setTimeout(() => this.as.closeAlert(this.alertName), 1800); }, get url() { var xul = `<?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <?xml-stylesheet href="chrome://browser/content/places/places.css"?> <?xml-stylesheet href="chrome://browser/skin/places/places.css"?> <?xml-stylesheet href="chrome://browser/skin/places/tree-icons.css"?> <dialog xmlns="${xulns}" id="bookmark-folder-saver-dialog" windowtype="bookmark-folder-saver:dialog" title="Выберите папку" buttons="accept,cancel" onload="init();" width="${this.width}" height="${this.height}"> <script type="application/javascript" src="chrome://global/content/globalOverlay.js"/> <script type="application/javascript" src="chrome://browser/content/utilityOverlay.js"/> <script type="application/javascript"><![CDATA[ ChromeUtils.defineModuleGetter(window, "PlacesUtils", "resource://gre/modules/PlacesUtils.jsm"); ChromeUtils.defineModuleGetter(window, "PlacesUIUtils", "resource:///modules/PlacesUIUtils.jsm"); ChromeUtils.defineModuleGetter(window, "PlacesTransactions", "resource://gre/modules/PlacesTransactions.jsm"); ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); XPCOMUtils.defineLazyScriptGetter(window, "PlacesTreeView", "chrome://browser/content/places/treeView.js"); XPCOMUtils.defineLazyScriptGetter( window, ["PlacesInsertionPoint", "PlacesController", "PlacesControllerDragHelper"],\n\ "chrome://browser/content/places/controller.js"\n\ ); ]]></script> <script type="application/javascript" src="chrome://browser/content/places/places-tree.js"/> <tree id="tree" type="places" is="places-tree" place="place:type=${ Ci.nsINavHistoryQueryOptions.RESULTS_AS_ROOTS_QUERY }&excludeItems=1&excludeQueries=1" hidecolumnpicker="true" seltype="single" flex="1"> <treecols> <treecol id="title" flex="1" primary="true" hideheader="true" /> </treecols> <treechildren /> </tree> <script type="application/javascript"><![CDATA[ var tree = document.getElementById("tree"); function init() { tree.selectItems([window.arguments[0]]); var ind = tree.view.selection.currentIndex; ind != -1 && setTimeout(() => { if ("nsITreeBoxObject" in Ci) { var tbo = tree.treeBoxObject; var visibleRows = tbo.height/tbo.rowHeight; } else { var tbo = tree; var visibleRows = tbo.getPageLength(); } var cur = tbo.view.selection.currentIndex; var first = tbo.getFirstVisibleRow(); var newFirst = cur - ${this.nodePosition}*visibleRows + 1; tbo.scrollByLines(Math.round(newFirst - first)); }, 0); var onKeydown = e => e.ctrlKey && e.key == "Enter" && !e.shiftKey && document.documentElement.acceptDialog(e.stopPropagation()); addEventListener("keydown", onKeydown, true); addEventListener("dialogaccept", dialogCallback); window.onunload = () => { removeEventListener("keydown", onKeydown, true); removeEventListener("dialogaccept", dialogCallback); } } function dialogCallback() { var ind = tree.view.selection.currentIndex; if (ind == -1) return; var item = tree.view.nodeForTreeIndex(ind); item && Services.prefs.setStringPref( "${pref}", PlacesUtils.getConcreteItemGuid(item) ); } ]]></script> </dialog>`; var url, type = "application/vnd.mozilla.xul+xml"; if (parseInt(Services.appinfo.platformVersion) >= 69 && Services.appinfo.browserTabsRemoteAutostart) { url = `chrome://custombuttons/content/cbfolderpicker${Date.now()}.xul`; var ams = Cc["@mozilla.org/addons/addon-manager-startup;1"].getService(Ci.amIAddonManagerStartup); this.helper = ams.registerChrome( Services.io.newFileURI(Services.dirsvc.get("ProfD", Ci.nsIFile)), [["override", url, `data:${type},${encodeURIComponent(xul)}`]] ); addDestructor(this.helper.destruct); } else { url = URL.createObjectURL(new Blob([xul], {type})); addDestructor(() => URL.revokeObjectURL(url)); } delete this.url; return this.url = url; } }, false, popup || 1))(document.getElementById("contentAreaContextMenu"));
Можете ли Вы привести простейший пример такой кнопки?
Могу, наверно
((id, g) => addDestructor(reason => id in g && g[id].destroy(reason)) || id in g || ({ actions: [{ title: "Обновить", tooltip: "tooltip", iconURL: "chrome://browser/content/robot.ico", id: "reloadButton", _insertBeforeActionID: "copyURL", onCommand: (e, btn) => e.view.BrowserReloadOrDuplicate(e) }], init() { g[id] = this; this.actions = this.actions.map(action => { action.extensionID = "custombuttons@xsms.org"; return g.PageActions.addAction(new g.PageActions.Action(action)); }); }, destroy(reason) { if (reason[5] != "e") return; delete g[id]; for(var action of this.actions) action.remove(); } }).init())( "CBPageActionsMaker", Cu.import("resource:///modules/PageActions.jsm", {}) );
Отсутствует
Garalf у меня нет 55, а что в ошибках пишет? У меня на 69 такой:
/*Initialization Code*/ // ==UserScript== // @name UserCSSLoader // @description CSS Codes - Styles laden und verwalten // @namespace http://d.hatena.ne.jp/Griever/ // @author Griever // @charset UTF-8 // @version 0.0.4f // ==/UserScript== var idb=this.id; var button = document.getElementById(idb); const xulNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; (function(){ var editor = "C:\\Program Files\\AkelPad\\AkelPad.exe"; let { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components; if (!window.Services) Cu.import("resource://gre/modules/Services.jsm"); let list = Services.wm.getEnumerator("navigator:browser"); while(list.hasMoreElements()){ if(list.getNext() != window) return; } if (window.UCL) { window.UCL.destroy(); delete window.UCL; } window.UCL = { USE_UC: "UC" in window, AGENT_SHEET: Ci.nsIStyleSheetService.AGENT_SHEET, USER_SHEET : Ci.nsIStyleSheetService.USER_SHEET, readCSS : {}, get disabled_list() { let obj = []; try { obj = this.prefs.getCharPref("disabled_list").split("|"); } catch(e) {} delete this.disabled_list; return this.disabled_list = obj; }, get prefs() { delete this.prefs; return this.prefs = Services.prefs.getBranch("UserCSSLoader.") }, get styleSheetServices(){ delete this.styleSheetServices; return this.styleSheetServices = Cc["@mozilla.org/content/style-sheet-service;1"].getService(Ci.nsIStyleSheetService); }, get FOLDER() { let aFolder; try { let folderPath = this.prefs.getCharPref("FOLDER"); aFolder = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile) aFolder.initWithPath(folderPath); } catch (e) { aFolder = Services.dirsvc.get("UChrm", Ci.nsIFile); aFolder.appendRelativePath("CSS"); } if (!aFolder.exists() || !aFolder.isDirectory()) { aFolder.create(Ci.nsIFile.DIRECTORY_TYPE, 0o664); } delete this.FOLDER; return this.FOLDER = aFolder; }, getFocusedWindow: function() { let win = document.commandDispatcher.focusedWindow; if (!win || win == window) win = content; return win; }, init: function() { const cbNS = "http://xsms.nm.ru/custombuttons/"; var menupopup = document.createElementNS(xulNS, "menupopup"); menupopup.onclick = function (event) { button.menuClick(event); } menupopup.addEventListener("popupshowing", function (event) { self.menuPopupShowing(event); }, false); button.appendChild(menupopup); button.type = "menu"; button.orient = "horizontal"; button.menuClick = function (event) { event.preventDefault(); event.stopPropagation(); button.open = false; } button.menuPopupShowing = function (event) { var nodeList = event.target.childNodes; for (var i = nodeList.length - 1; i >= 0; i--) if (nodeList[i].hasAttributeNS(cbNS, "flag")) nodeList[i].parentNode.removeChild(nodeList[i]); } let cssmenu = $C("menu", { id: "usercssloader-menu", label: "CSS", }); menupopup.appendChild(cssmenu); let menupop = $C("menupopup", { id: "usercssloader-menupopup" }); cssmenu.appendChild(menupop); let menu = $C("menu", { label: "Инструменты", }); menupopup.appendChild(menu); let mp = $C("menupopup", { id: "usercssloader-submenupopup" }); menu.appendChild(mp); mp.appendChild($C("menuitem", { label: "Обновить список файлов-стилей", accesskey: "R", acceltext: "Alt + R", oncommand: "UCL.rebuild();" })); mp.appendChild($C("menuseparator")); mp.appendChild($C("menuitem", { label: "Создать файл CSS", accesskey: "D", oncommand: "UCL.create();" })); mp.appendChild($C("menuitem", { label: "Открыть папку CSS", accesskey: "O", oncommand: "UCL.openFolder();" })); mp.appendChild($C("menuitem", { label: "Редактировать userChrome.css", hidden: false, oncommand: "UCL.editUserCSS(\'userChrome.css\');" })); mp.appendChild($C("menuitem", { label: "Редактировать userContent.css", hidden: false, oncommand: "UCL.editUserCSS(\'userContent.css\');" })); mp.appendChild($C("menuseparator")); mp.appendChild($C("menuitem", { label: "Тест стиля (Chrome)", id: "usercssloader-test-chrome", //hidden: true, accesskey: "C", oncommand: "UCL.styleTest(window);" })); mp.appendChild($C("menuitem", { label: "Тест стиля (Web)", id: "usercssloader-test-content", //hidden: true, accesskey: "W", oncommand: "UCL.styleTest();" })); mp.appendChild($C("menuitem", { label: "Поиск стиля на userstyles.org", accesskey: "S", oncommand: "UCL.searchStyle();" })); menu = $C("menu", { label: ".uc.css", accesskey: "U", hidden: !UCL.USE_UC }); mp = $C("menupopup", { id: "usercssloader-ucmenupopup" }); menu.appendChild(mp); mp.appendChild($C("menuitem", { label: "Importieren(.uc.js)", oncommand: "UCL.UCrebuild();" })); mp.appendChild($C("menuseparator", { id: "usercssloader-ucsepalator" })); $("mainKeyset").appendChild($C("key", { id: "usercssloader-rebuild-key", oncommand: "UCL.rebuild();", key: "R", modifiers: "alt", })); this.rebuild(); this.initialized = true; if (UCL.USE_UC) { setTimeout(function() { UCL.UCcreateMenuitem(); }, 1000); } window.addEventListener("unload", this, false); }, uninit: function() { const dis = []; for (let x of Object.keys(this.readCSS)) { if (!this.readCSS[x].enabled) dis.push(x); } this.prefs.setCharPref("disabled_list", dis.join("|")); window.removeEventListener("unload", this, false); }, destroy: function() { var i = document.getElementById("usercssloader-menu"); if (i) i.parentNode.removeChild(i); var i = document.getElementById("usercssloader-rebuild-key"); if (i) i.parentNode.removeChild(i); this.uninit(); }, handleEvent: function(event) { switch(event.type){ case "unload": this.uninit(); break; } }, rebuild: function() { let ext = /\.css$/i; let not = /\.uc\.css/i; let files = this.FOLDER.directoryEntries.QueryInterface(Ci.nsISimpleEnumerator); while (files.hasMoreElements()) { let file = files.getNext().QueryInterface(Ci.nsIFile); if (!ext.test(file.leafName) || not.test(file.leafName)) continue; let CSS = this.loadCSS(file); CSS.flag = true; } for (let leafName of Object.keys(this.readCSS)) { const CSS = this.readCSS[leafName]; if (!CSS.flag) { CSS.enabled = false; delete this.readCSS[leafName]; } delete CSS.flag; this.rebuildMenu(leafName); } if (this.initialized) { if (typeof(StatusPanel) !== "undefined") StatusPanel._label = "Style importiert"; else XULBrowserWindow.statusTextField.label = "Styles importieren"; } }, loadCSS: function(aFile) { var CSS = this.readCSS[aFile.leafName]; if (!CSS) { CSS = this.readCSS[aFile.leafName] = new CSSEntry(aFile); if (this.disabled_list.indexOf(CSS.leafName) === -1) { CSS.enabled = true; } } else if (CSS.enabled) { CSS.enabled = true; } return CSS; }, rebuildMenu: function(aLeafName) { var CSS = this.readCSS[aLeafName]; var menuitem = document.getElementById("usercssloader-" + aLeafName); if (!CSS) { if (menuitem) menuitem.parentNode.removeChild(menuitem); return; } if (!menuitem) { menuitem = document.createElementNS(xulNS, "menuitem"); menuitem.setAttribute("label", aLeafName); menuitem.setAttribute("id", "usercssloader-" + aLeafName); menuitem.setAttribute("class", "usercssloader-item " + (CSS.SHEET == this.AGENT_SHEET? "AGENT_SHEET" : "USER_SHEET")); menuitem.setAttribute("type", "checkbox"); menuitem.setAttribute("autocheck", "false"); menuitem.setAttribute("oncommand", "UCL.toggle('"+ aLeafName +"');"); menuitem.setAttribute("onclick", "UCL.itemClick(event);"); document.getElementById("usercssloader-menupopup").appendChild(menuitem); } menuitem.setAttribute("checked", CSS.enabled); }, toggle: function(aLeafName) { var CSS = this.readCSS[aLeafName]; if (!CSS) return; CSS.enabled = !CSS.enabled; this.rebuildMenu(aLeafName); }, itemClick: function(event) { if (event.button == 0) return; event.preventDefault(); event.stopPropagation(); let label = event.currentTarget.getAttribute("label"); if (event.button == 1) { this.toggle(label); } else if (event.button == 2) { closeMenus(event.target); this.edit(this.getFileFromLeafName(label)); } }, getFileFromLeafName: function(aLeafName) { let f = this.FOLDER.clone(); f.QueryInterface(Ci.nsIFile); // use appendRelativePath f.appendRelativePath(aLeafName); return f; }, styleTest: function(aWindow) { aWindow || (aWindow = this.getFocusedWindow()); new CSSTester(aWindow, function(tester){ if (tester.saved) UCL.rebuild(); }); }, searchStyle: function() { let word; try { word = gBrowser.currentURI.host; } catch { word = gBrowser.currentURI.spec; } var ctabpos = gBrowser.selectedTab._tPos +1; gBrowser.moveTabTo(gBrowser.selectedTab = gBrowser.addWebTab("https://userstyles.org/styles/search/" + word), ctabpos); }, openFolder: function() { this.FOLDER.launch(); }, editUserCSS: function(aLeafName) { let file = Services.dirsvc.get("UChrm", Ci.nsIFile); file.appendRelativePath(aLeafName); this.edit(file); }, edit: function(aFile) { try { var UI = Cc["@mozilla.org/intl/scriptableunicodeconverter"].createInstance(Ci.nsIScriptableUnicodeConverter); UI.charset = window.navigator.platform.toLowerCase().indexOf("win") >= 0? "Shift_JIS": "UTF-8"; var path = UI.ConvertFromUnicode(aFile.path); var app = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile); app.initWithPath(editor); var process = Cc["@mozilla.org/process/util;1"].createInstance(Ci.nsIProcess); process.init(app); process.run(false, [path], 1); } catch (e) {} }, create: function(aLeafName) { if (!aLeafName) aLeafName = prompt("Имя файла", dateFormat(new Date(), "%Y_%m%d_%H%M%S")); if (aLeafName) aLeafName = aLeafName.replace(/\s+/g, " ").replace(/[\\/:*?\"<>|]/g, ""); if (!aLeafName || !/\S/.test(aLeafName)) return; if (!/\.css$/.test(aLeafName)) aLeafName += ".css"; let file = this.getFileFromLeafName(aLeafName); this.edit(file); }, UCrebuild: function() { let re = /^file:.*\.uc\.css(?:\?\d+)?$/i; let query = "?" + new Date().getTime(); Array.slice(document.styleSheets).forEach(function(css){ if (!re.test(css.href)) return; if (css.ownerNode) { css.ownerNode.parentNode.removeChild(css.ownerNode); } let pi = document.createProcessingInstruction('xml-stylesheet','type="text/css" href="'+ css.href.replace(/\?.*/, '') + query +'"'); document.insertBefore(pi, document.documentElement); }); UCL.UCcreateMenuitem(); }, UCcreateMenuitem: function() { let sep = $("usercssloader-ucsepalator"); let popup = sep.parentNode; if (sep.nextSibling) { let range = document.createRange(); range.setStartAfter(sep); range.setEndAfter(popup.lastChild); range.deleteContents(); range.detach(); } let re = /^file:.*\.uc\.css(?:\?\d+)?$/i; Array.slice(document.styleSheets).forEach(function(css) { if (!re.test(css.href)) return; let fileURL = decodeURIComponent(css.href).split("?")[0]; let aLeafName = fileURL.split("/").pop(); let m = document.createElementNS(xulNS, "menuitem"); m.setAttribute("label", aLeafName); m.setAttribute("tooltiptext", fileURL); m.setAttribute("id", "usercssloader-" + aLeafName); m.setAttribute("type", "checkbox"); m.setAttribute("autocheck", "false"); m.setAttribute("checked", "true"); m.setAttribute("oncommand", "this.setAttribute('checked', !(this.css.disabled = !this.css.disabled));"); m.setAttribute("onclick", "UCL.UCItemClick(event);"); m.css = css; popup.appendChild(m); }); }, UCItemClick: function(event) { if (event.button == 0) return; event.preventDefault(); event.stopPropagation(); if (event.button == 1) { event.target.doCommand(); } else if (event.button == 2) { closeMenus(event.target); let fileURL = event.currentTarget.getAttribute("tooltiptext"); let file = Services.io.getProtocolHandler("file").QueryInterface(Ci.nsIFileProtocolHandler).getFileFromURLSpec(fileURL); this.edit(file); } }, }; function CSSEntry(aFile) { this.path = aFile.path; this.leafName = aFile.leafName; this.lastModifiedTime = 1; this.SHEET = /^xul-|\.as\.css$/i.test(this.leafName) ? Ci.nsIStyleSheetService.AGENT_SHEET: Ci.nsIStyleSheetService.USER_SHEET; } CSSEntry.prototype = { sss: Cc["@mozilla.org/content/style-sheet-service;1"].getService(Ci.nsIStyleSheetService), _enabled: false, get enabled() { return this._enabled; }, set enabled(isEnable) { var aFile = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile) aFile.initWithPath(this.path); var isExists = aFile.exists(); // Wenn die Datei existiert true var lastModifiedTime = isExists ? aFile.lastModifiedTime : 0; var isForced = this.lastModifiedTime != lastModifiedTime; var fileURL = Services.io.getProtocolHandler("file").QueryInterface(Ci.nsIFileProtocolHandler).getURLSpecFromFile(aFile); var uri = Services.io.newURI(fileURL, null, null); if (this.sss.sheetRegistered(uri, this.SHEET)) { if (!isEnable || !isExists) { this.sss.unregisterSheet(uri, this.SHEET); } else if (isForced) { // Nach Stornierung erneut einlesen this.sss.unregisterSheet(uri, this.SHEET); this.sss.loadAndRegisterSheet(uri, this.SHEET); } } else { if (isEnable && isExists) { this.sss.loadAndRegisterSheet(uri, this.SHEET); } } if (this.lastModifiedTime !== 1 && isEnable && isForced) { log(this.leafName + " wurde aktualisiert"); } this.lastModifiedTime = lastModifiedTime; return this._enabled = isEnable; }, }; function CSSTester(aWindow, aCallback) { this.win = aWindow || window; this.doc = this.win.document; this.callback = aCallback; this.init(); } CSSTester.prototype = { sss: Cc["@mozilla.org/content/style-sheet-service;1"].getService(Ci.nsIStyleSheetService), preview_code: "", saved: false, init: function() { var url = "data:text/html;charset=utf8,"+encodeURIComponent('<!DOCTYPE HTML><html lang="ja"><head><title>CSSTester</title></head><body></body></html>'); if (parseInt(Services.appinfo.platformVersion) >= 69 && Services.appinfo.browserTabsRemoteAutostart) { var chromeURL = `chrome://custombuttons/content/cbdialog${Date.now()}.xul`; Cc["@mozilla.org/addons/addon-manager-startup;1"].getService(Ci.amIAddonManagerStartup).registerChrome( Services.io.newFileURI(Services.dirsvc.get("ProfD", Ci.nsIFile)), [["override", chromeURL, url]] ); url = chromeURL; } this.dialog = openDialog(url, "", "width=550,height=400,dialog=no"); this.dialog.addEventListener("load", this, false); }, destroy: function() { this.preview_end(); this.dialog.removeEventListener("unload", this, false); this.previewButton.removeEventListener("click", this, false); this.saveButton.removeEventListener("click", this, false); this.closeButton.removeEventListener("click", this, false); }, handleEvent: function(event) { switch(event.type) { case "click": if (event.button != 0) return; if (this.previewButton == event.currentTarget) { this.preview(); } else if (this.saveButton == event.currentTarget) { this.save(); } else if (this.closeButton == event.currentTarget) { this.dialog.close(); } break; case "load": var doc = this.dialog.document; doc.body.innerHTML = '\ <style type="text/css">\ :not(input):not(select) { padding: 0px; margin: 0px; }\ table { border-spacing: 0px; }\ body, html, #main, #textarea { width: 100%; height: 100%; }\ #textarea { font-family: monospace; }\ </style>\ <table id="main">\ <tr height="100%">\ <td colspan="4"><textarea id="textarea"></textarea></td>\ </tr>\ <tr height="40">\ <td><input type="button" value="Vorschau" id="Vorschau"/></td>\ <td><input type="button" value="Speichern" id="Speichern"/></td>\ <td width="80%"><span class="log"></span></td>\ <td><input type="button" value="Schließen" id="Schliessen"/></td>\ </tr>\ </table>\ '; this.textbox = doc.querySelector("textarea"); this.previewButton = doc.querySelector('input[value="Vorschau"]'); this.saveButton = doc.querySelector('input[value="Speichern"]'); this.closeButton = doc.querySelector('input[value="Schließen"]'); this.logField = doc.querySelector('.log'); var code = "@namespace url(" + this.doc.documentElement.namespaceURI + ");\n"; code += this.win.location.protocol.indexOf("http") === 0? "@-moz-document domain(" + this.win.location.host + ") {\n\n\n\n}": "@-moz-document url(" + this.win.location.href + ") {\n\n\n\n}"; this.textbox.value = code; this.dialog.addEventListener("unload", this, false); this.previewButton.addEventListener("click", this, false); this.saveButton.addEventListener("click", this, false); this.closeButton.addEventListener("click", this, false); this.textbox.focus(); let p = this.textbox.value.length - 3; this.textbox.setSelectionRange(p, p); break; case "unload": this.destroy(); this.callback(this); break; } }, preview: function() { var code = this.textbox.value; if (!code || !/\:/.test(code)) return; code = "data:text/css;charset=utf-8," + encodeURIComponent(this.textbox.value); if (code == this.preview_code) return; this.preview_end(); var uri = Services.io.newURI(code, null, null); this.sss.loadAndRegisterSheet(uri, Ci.nsIStyleSheetService.AGENT_SHEET); this.preview_code = code; this.log("Preview"); }, preview_end: function() { if (this.preview_code) { let uri = Services.io.newURI(this.preview_code, null, null); this.sss.unregisterSheet(uri, Ci.nsIStyleSheetService.AGENT_SHEET); this.preview_code = ""; } }, save: function() { var data = this.textbox.value; if (!data) return; var fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker); fp.init(window, "", Ci.nsIFilePicker.modeSave); fp.appendFilter("CSS Files","*.css"); fp.defaultExtension = "css"; if (window.UCL) fp.displayDirectory = UCL.FOLDER; var res = fp.show(); if (res != fp.returnOK && res != fp.returnReplace) return; var suConverter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].createInstance(Ci.nsIScriptableUnicodeConverter); suConverter.charset = "UTF-8"; data = suConverter.ConvertFromUnicode(data); var foStream = Cc["@mozilla.org/network/file-output-stream;1"].createInstance(Ci.nsIFileOutputStream); foStream.init(fp.file, 0x02 | 0x08 | 0x20, 0o664, 0); foStream.write(data, data.length); foStream.close(); this.saved = true; }, log: function() { this.logField.textContent = dateFormat(new Date(), "%H:%M:%S") + ": " + $A(arguments); } }; UCL.init(); function $(id) { return document.getElementById(id); } function $A(arr) { return Array.slice(arr); } function $C(name, attr) { var el = document.createElementNS(xulNS, name); if (attr) Object.keys(attr).forEach(function(n) { el.setAttribute(n, attr[n]) }); return el; } function dateFormat(date, format) { format = format.replace("%Y", ("000" + date.getFullYear()).substr(-4)); format = format.replace("%m", ("0" + (date.getMonth()+1)).substr(-2)); format = format.replace("%d", ("0" + date.getDay()).substr(-2)); format = format.replace("%H", ("0" + date.getHours()).substr(-2)); format = format.replace("%M", ("0" + date.getMinutes()).substr(-2)); format = format.replace("%S", ("0" + date.getSeconds()).substr(-2)); return format; } function log() { Application.console.log(Array.slice(arguments)); } })();
Отредактировано Andrey_Krropotkin (25-09-2019 11:53:02)
Отсутствует
Неподписанные расширения сдохли, а править omni.ja считаю некроманством 81лвл) я не настолько крут, просто каждый раз при обнове его править... итак хватает что надо после обнов править тут еще это, хотя наверно пару файлов подсунуть на автомате можно, с помощью "user_chrome.manifest" от Vitaliy V.
Отредактировано func4ptch4 (26-09-2019 13:03:20)
Отсутствует
Andrey_Krropotkin
Кнопка SAVE , совмещенная , Сохранить как HTML -там все нормально? Обратно в браузере и шняга какая-то...
Вопрос снят, Это 69.0.1 глючила, правда, выбранное Html - никак...
Отредактировано solombala (01-10-2019 11:14:35)
Отсутствует
solombala проверить пока не могу в командировке до 15
Отсутствует
Кто знает, что делает этот код? вроде "long left click"? (если) так то он не работает.
//Uncnown code (code=>{ var delay = 500; // время удержания в мс var inBackground = true; // открывать в фоновой вкладке var relatedToCurrent = true; // открывать рядом с related вкладкой var p = "CB" + _id.slice(20) + ":LongPressHandler:"; var msgDestroy = p + "Destroy", msgResponse = p + "Response"; code = code.replace(/%MD%/g, msgDestroy).replace("%MR%", msgResponse) .replace("%DL%", delay).replace("%BG%", inBackground); var url = "data:," + encodeURIComponent(code); var mm = window.getGroupMessageManager("browsers"); mm.loadFrameScript(url, true); function handleLongPress(msg) { var [link, ref, ctrl] = msg.data; var bg = inBackground != null ? inBackground : Services.prefs.getBoolPref("browser.tabs.loadInBackground"); gBrowser.loadOneTab(link, { relatedToCurrent, inBackground: ctrl != bg, //referrerURI: makeURI(ref) }); } mm.addMessageListener(msgResponse, handleLongPress); addDestructor(() => { mm.removeDelayedFrameScript(url); mm.broadcastAsyncMessage(msgDestroy); mm.removeMessageListener(msgResponse, handleLongPress); }); })(`({ init() { addEventListener("mousedown", this, false); addMessageListener("%MD%", this); }, receiveMessage() { removeEventListener("mousedown", this, false); removeMessageListener("%MD%", this); }, handleEvent(e) { if (e.type == "mousedown") { if (e.button || e.shiftKey || e.altKey || e.detail != 1) return; var a = e.originalTarget.closest("a[href]"); if (!a || a.href.startsWith("javascript:")) return; this.ctrl = e.ctrlKey; this.initLongPress(a); } else { if (e.type == "click" && !this.link) e.preventDefault(); this.destroyLongPress(); } }, get timer() { delete this.timer; return this.timer = Cc["@mozilla.org/timer;1"] .createInstance(Ci.nsITimer); }, notify() { sendSyncMessage("%MR%", [this.link.href, this.link.ownerDocument.URL, this.ctrl]); this.link = null; if (!%BG%) this.destroyLongPress(); }, initLongPress(a) { addEventListener("click", this, true); addEventListener("dragstart", this, false); this.timer.initWithCallback(this, %DL%, this.timer.TYPE_ONE_SHOT); this.link = a; }, destroyLongPress() { removeEventListener("click", this, true); removeEventListener("dragstart", this, false); this.link && this.timer.cancel(); this.link = null; } }).init();`);
Отредактировано func4ptch4 (02-10-2019 09:33:39)
Отсутствует