Полезная информация

Юристы зарабатывают огромные деньги и славу, оперируя хорошим знанием законов. Правила форума — простой путь к успешному общению.

№1465130-05-2020 00:54:46

kokoss
Участник
 
Группа: Members
Зарегистрирован: 15-02-2018
Сообщений: 1734
UA: Firefox 52.0

Re: Custom Buttons

Vitaliy V.
Большое спасибо, в about:addons получилось изменить иконку, но она почему то не отображается в кнопке_Toggle Restartless Add-ons ?

Отредактировано kokoss (30-05-2020 14:41:28)


Win7

Отсутствует

 

№1465230-05-2020 01:16:02

Vitaliy V.
Участник
 
Группа: Members
Зарегистрирован: 19-09-2014
Сообщений: 2186
UA: Firefox 77.0

Re: Custom Buttons

kokoss
ну мало ли где ещё она не отобразится, это же не замена как таковая, а стиль

скрытый текст

Выделить код

Код:

#ucf-cbbtn-ToggleRestartlessAddons menuitem[image*="add_toolbar_buttons@vitaliy.ru.xpi"] .menu-iconic-icon {
    object-position: 16px center !important;
    background-color: transparent !important;
    background-repeat: no-repeat !important;
    background-size: 16px !important;
    background-image: url("chrome://user_chrome_files/content/vertical_top_bottom_bar/svg/configure-toolbars-16.svg") !important;
}

Отредактировано Vitaliy V. (30-05-2020 01:16:37)

Отсутствует

 

№1465330-05-2020 11:01:03

Dumby
Участник
 
Группа: Members
Зарегистрирован: 12-08-2012
Сообщений: 2217
UA: Firefox 52.0

Re: Custom Buttons

kokoss пишет

кое что нашёл

OK, DOMi 7.0.7
dom_inspector-7.0.7-fx-paxmod_xpi
dom_inspector-7.0.7-fx-bootstrap_xpi
И, позволю себе напомнить

скрытый текст
Это не тот DOMi, что был когда-то, многое не работает.
Это не restartless расширение, после установки нужен рестарт.
И да, рестарт с очисткой startupCache, можно программно (проще),
можно вручную (надёжнее).


Так же, раз уж речь зашла об иконках, то стоит отметить,
что если положить (и назвать) иконку по пути (разумеется, говорю только за Win7)
%Папка_где_лежит_firefox.exe%\browser\chrome\icons\default\winInspectorMain.ico


то окна DOMi, сответственно, будут с этой иконкой.


unter_officer
Премного извиняюсь, выбрал иконку от kokoss :blush:

Отсутствует

 

№1465430-05-2020 13:38:24

katana
Участник
 
Группа: Members
Зарегистрирован: 04-09-2019
Сообщений: 25
UA: Firefox 77.0

Re: Custom Buttons

Dumby, №14689
Странно, что-то не сработало, и до этого по идее тогда и "custombuttons.initAutoPopup=" должен был подхватывать все CB, но он не подхватывал, я в каждый CB добавлял;
this.type="menu";custombuttons.initAutoPopup(self);
this.matches("toolbar[orient=vertical]>:scope")&&menuPopup.setAttribute("position","end_before");
Что то трудный переход оказался, а так 4кнопки надо перекинуть с попапом..

Отредактировано katana (30-05-2020 16:26:10)

Отсутствует

 

№1465530-05-2020 14:33:56

kokoss
Участник
 
Группа: Members
Зарегистрирован: 15-02-2018
Сообщений: 1734
UA: Firefox 52.0

Re: Custom Buttons

Dumby
Класссссс 529d356c7ab0.gif и большое спасибо за f5c5e2c031cc.png 7.0.7

Отредактировано kokoss (30-05-2020 14:36:33)


Win7

Отсутствует

 

№1465601-06-2020 12:44:39

sandro79
Участник
 
Группа: Members
Зарегистрирован: 15-11-2017
Сообщений: 1750
UA: Firefox 76.0

Re: Custom Buttons

katana пишет

Ладно не надо, запарился умолять

А вы многим тут помогли!? Тут никому не платят, никто никому не должен, и ни на кого молится не нужно.
Мало ли какие у человека проблемы, что он вам сразу не ответил, или не ответит вообще.

katana пишет

На такой форум, где 1000тем мертвых кроме 3-4, которые в зачатке умереть.
Даже теже самые стили, где тоже уже игнорят, но хоть помогают по мелочям, уже погибает единственная живая тема на всем сайте.

Ну так найдите другой форум с живыми темами и помогайте там людям. Также, темы на этом форуме поддерживайте, и не только "те же самые стили", а и другие, никто вам не запрещает этого делать, даже может иной раз и спасибо сподобятся сказать. Не дайте этому форуму умереть!

Отсутствует

 

№1465701-06-2020 16:25:28

Dumby
Участник
 
Группа: Members
Зарегистрирован: 12-08-2012
Сообщений: 2217
UA: Firefox 52.0

Отсутствует

 

№1465801-06-2020 16:34:21

kokoss
Участник
 
Группа: Members
Зарегистрирован: 15-02-2018
Сообщений: 1734
UA: Firefox 52.0

Re: Custom Buttons

Dumby пишет

custom_buttons-0.0.7.0.0.14-fx-paxmod.xpi

Спасибо :beer:

Отредактировано kokoss (09-09-2020 22:36:47)


Win7

Отсутствует

 

№1465901-06-2020 21:55:57

Andrey_Krropotkin
Участник
 
Группа: Members
Зарегистрирован: 11-11-2011
Сообщений: 482
UA: Firefox 76.0

Re: Custom Buttons

Dumby обновил до custom_buttons-0.0.7.0.0.14-fx-paxmod.xpi из 12 и что-то перестал работать такой код

скрытый текст

Выделить код

Код:

/*Initialization Code*/
/////////////////////////////// Переместить кнопку ///////////////////////////////

this.MoveToolbarButtons = MTB = {
	// Start editable preferences
	MoveButtonMICBContext: true, // Add "Move button" menu item to Custom Buttons context menu?
	MoveButtonMITBarContext: false, // Add "Move button" menu item to toolbars context menu?
	ShowMoveAlert: false, // Show the alert with instructions when moving buttons?
	MoveBtnImage: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAYklEQVQ4jWNgGJTgaAXHf2LEcGrGZQBBQ45WcPz/fZ0XpwG45FAUEDIAqzyyJLIiZIxNHqdmYvHRCo7/DLhsIEYziivQDcHnBawxgqyQUCzgjQlC6YCotEB2QkJWTIzY4AAAezv/caeCLKcAAAAASUVORK5CYII=",
	// End editable preferences

	_UID: "__cb_move_toolbar_buttons_" + custombuttons.getNumber(self.id),
	WindowIDs: ["main-window", "messengerWindow", "msgcomposeWindow"],
	ToolbarContexIDs: ["toolbar-context-menu", "aios-toolbar-contextmenu", "aios-sbhtoolbar-contextmenu"],
	Pref: "extensions.custombuttons.MoveToolbarButtons.Id" + custombuttons.getNumber(self.id) + ".MoveButtonID",
	SP: Services.prefs,

	Init: function() {
		if (!(MTB._UID in window)) {
			window[MTB._UID] = {
				Initialized: false
			};
		}

		if (!window[MTB._UID]["Initialized"]) {
			window[MTB._UID]["Initialized"] = true;
			custombuttons.isPref(MTB.Pref, "");

			if ("CustomizableUI" in window) {
				var originalFunction = custombuttons.persistCurrentSets.toString();
				eval("custombuttons.persistCurrentSets=" + originalFunction
					.replace(", newButtonId)", ", newButtonId, aToRight)")
					.replace("pos + 1", "aToRight ? pos : pos + 1"));
			}

			if (MTB.MoveButtonMICBContext) {
				var contextPops = document.getElementsByTagName("menupopup");
				let p = 0,
					pLen = contextPops.length;
				for (; p < pLen; p++) {
					var cPopID = contextPops[p].id;
					if (cPopID.substr(0, 26) === "custombuttons-contextpopup") {
						var cPopEl = document.getElementById(cPopID);
						var moveMIID = "custombuttons-contextpopup-moveButton" + cPopID.slice(26);
						var moveMIEl = document.getElementById(moveMIID);
						if (!moveMIEl)
							MTB.CreateMoveMI(moveMIID, cPopEl);
					}
				}
			}

			if (MTB.MoveButtonMITBarContext) {
				Array.prototype.slice.call(MTB.ToolbarContexIDs).forEach(function(aTBCtxID, aIndex) {
					let Ctx = document.getElementById(aTBCtxID);
					let tBarCtxMIID = MTB._UID + "moveButton" + aIndex;
					if (!document.getElementById(tBarCtxMIID)) {
						if (Ctx) {
							MTB.CreateMoveMI(tBarCtxMIID, Ctx);
							Ctx.addEventListener("popupshowing", function(aE) {
								document.getElementById(tBarCtxMIID).hidden = (document.popupNode.tagName !== "toolbarbutton");
							}, false);
						}
					}
				});
			}

			addDestructor(function(aReason) {
				if (aReason === "delete") {
					SP.resetUserPrefs(MTB.Pref);
					delete window[_UID];
				}
				if (aReason === "delete" || aReason === "update") {
					window[MTB._UID]["Initialized"] = false;
				}
			});
		}
	},

	getPopupNode: function(aEl) {
		if (custombuttons.popupNode)
			return custombuttons.popupNode;
		var popupNode = aEl;
		while (popupNode.tagName.toLowerCase() !== "toolbarbutton") {
			popupNode = popupNode.parentNode;
		}
		return popupNode;
	},

	CreateMoveMI: function(aMItemID, aPopupEl) {
		let moveMIEl = aPopupEl.appendChild(document.createElementNS(xulns, "menuitem"));
		moveMIEl.setAttribute("id", aMItemID);
		moveMIEl.setAttribute("label", "Переместить кнопку...");
		moveMIEl.setAttribute("class", "menuitem-iconic");
		moveMIEl.setAttribute("image", MTB.MoveBtnImage);
		moveMIEl.setAttribute("tooltip", MTB._UID + "moveButtonMI_tooltip");
		moveMIEl.setAttribute("onclick", "document.getElementById(\"" +
			self.id + "\").MoveToolbarButtons.MoveOnClick(event);");
	},
	MoveOnClick: function(aE) {
		var popupNode = MTB.getPopupNode(aE.target);
		if (!popupNode)
			return;
		aE.stopPropagation();
		aE.preventDefault();
		if (aE.button === 0 && !aE.shiftKey && !aE.ctrlKey && !aE.altKey) {
			MTB.SP.setCharPref(MTB.Pref, popupNode.id);
			window.addEventListener('click', MTB.MoveListener, true);
			window.addEventListener('mouseup', MTB.DefaultPrevention, true);
			window.addEventListener('mousedown', MTB.DefaultPrevention, true);
			window.addEventListener('contextmenu', MTB.DefaultPrevention, true);
			MTB.HidePopup(aE.target);
			MTB.ShowMoveAlert && Services.prompt.alert(null, self.name,
				"Now click ANY toolbarbutton element inside ANY toolbar.\n" +
				"Left click will position the button to the left of the target.\n" +
				"Right click will position the button to the right of the target.\n\n" +
				"To cancel the movement, just click ANY element inside the browser that IS NOT a toolbarbutton.\n");
		}
	},
MoveListener: function(aE) {
		MTB.DefaultPrevention(aE);
		window.removeEventListener('click', MTB.MoveListener, true);
		window.removeEventListener('mouseup', MTB.DefaultPrevention, true);
		window.removeEventListener('mousedown', MTB.DefaultPrevention, true);
		window.removeEventListener('contextmenu', MTB.DefaultPrevention, true);
		var anchor = aE.target;
		if (anchor.tagName !== "toolbarbutton")
			return;
		var toolbar = anchor.parentNode;
		var BtnToMove = document.getElementById(MTB.SP.getCharPref(MTB.Pref));
		if (aE.button === 0 && !aE.shiftKey && !aE.ctrlKey && !aE.altKey)
			toolbar.insertBefore(BtnToMove, anchor);
		else if (aE.button === 2 && !aE.shiftKey && !aE.ctrlKey && !aE.altKey)
			toolbar.insertBefore(BtnToMove, anchor.nextSibling);
		if ("CustomizableUI" in window)
			custombuttons.persistCurrentSets(toolbar.id, anchor.id,
				BtnToMove.id || BtnToMove.getAttribute("id"), !(aE.button === 2));
		else {
			toolbar.setAttribute("currentset", toolbar.currentSet);
			document.persist(toolbar.id, "currentset");
		}
		MTB.SP.setCharPref(MTB.Pref, "");
	},

	DefaultPrevention: function(aE) {
		aE.preventDefault();
		aE.stopImmediatePropagation && aE.stopImmediatePropagation();
		aE.stopPropagation();
	},

	Tooltips: function(aRem) {
		var popSetID = MTB._UID + "popupset";
		var popSetEl = document.getElementById(popSetID);
		if (popSetEl)
			popSetEl.parentNode.removeChild(popSetEl);

		if (aRem)
			return;

		if (!popSetEl) {
			popSetEl = document.createElementNS(xulns, "popupset");
			popSetEl.setAttribute("id", popSetID);
		}

		popSetEl.appendChild(MTB.parseXML("<tooltip xmlns=\"" + xulns + "\" xmlns:html=\"" + xhtmlns +
			"\" id=\"" + MTB._UID + "moveButtonMI_tooltip" + "\">" +
			"<description><html:b>Instructions</html:b> : After clicking this menu item, you can " +
			"click ANY toolbarbutton element inside the application to place the currently " +
			"selected button to the left (with Left click) or to the right (with Right click) " +
			"of the targeted toolbarbutton.</description>" +
			"<separator/>" +
			"<description><html:b>Note</html:b> : It can be ANY toolbarbutton, not just " +
			"other Custom Buttons.</description>" +
			"</tooltip>"));

		setTimeout(function() {
			Array.prototype.slice.call(MTB.WindowIDs).forEach(function(aWinID) {
				let win = document.getElementById(aWinID);
				if (win)
					!document.getElementById(popSetID) && win.appendChild(popSetEl);
			});
		}, 100);
	},

	parseXML: function(aXML) { // Return parsed XML
		aXML = aXML.replace(/>\s+</g, "><"); // Linearize XML
		return (new DOMParser).parseFromString(aXML, "application/xml").documentElement;
	},

	HidePopup: function(aEl) {
		try {
			aEl.hidePopup();
		} catch (aError) {
			try {
				aEl.parentNode.hidePopup();
			} catch (aError) {
				try {
					aEl.parentNode.parentNode.hidePopup();
				} catch (aError) {
					try {
						aEl.parentNode.parentNode.parentNode.hidePopup();
					} catch (aError) {}
				}
			}
		}
	}
};

this.MoveToolbarButtons.Init();


Погляди пожайлуста

Отсутствует

 

№1466001-06-2020 22:19:20

shulep22
Участник
 
Группа: Members
Зарегистрирован: 01-06-2020
Сообщений: 7
UA: Chrome 83.0

Re: Custom Buttons

у меня тоже перестала работать кнопка,,видео в плеере,, Mozilla 77.0
https://anonfiles.com/n9L9p345oc/CB_buttons_01.05.2019._5_18_16_html

Отсутствует

 

№1466101-06-2020 22:32:31

solombala
Забанен
 
Группа: Members
Зарегистрирован: 20-07-2019
Сообщений: 652
UA: Firefox 75.0

Re: Custom Buttons

shulep22
Где нарыл эту кнопку убогую? Это устаревшее фуфло...Без мультипроцесса  есть  норм. Плеер на выбор и прописать в двух местах , см внимательно

скрытый текст

Выделить код

Код:

/*Initialization Code*/

var path = 'D:\\GOMPlayer\\GOM.exe'

var sysPlayerName = "GOM Player";

var openIn = "Откыть в "+sysPlayerName;
var videoMoved = "Видео перенесено в "+sysPlayerName;
var noFound = "Не найдено видео на странице, доступное для переноса в "+sysPlayerName;

var YoutubeID = /(?:youtube(?:-nocookie)?\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})(?:\W|$)/;



if(!(cbu.getPrefs("CB.video")) || cbu.getPrefs("CB.video").length < 9) cbu.setPrefs("CB.video", "videotoplayer");
var tmp = '',
tmpp = '',
innerA = '<div style="display:block!important;color:#00ff00!important;width:250px!important;font:bold 16px serif!important;z-index:999!important;opacity:1!important;visibility: visible!important;',
innerB = 'left:5px!important;position:absolute!important;height:auto!important;box-sizing:border-box!important;padding:5px!important;margin:5px!important;',
stopPl = "javascript:(function(){v=document.getElementById('movie_player');if(v){v.stopVideo()}else{v=document.getElementsByTagName('video');if(v){v[0].src='';try{v[0].load()}catch(e){}};}})();",
ytIMGouter = function(ytID) {return '<div width="100%"><br /><a target="_blank" href="https://www.youtube.com/watch?v=' + ytID + '"><img src="https://i.ytimg.com/vi/' + ytID + '/hqdefault.jpg"></a><br />' + innerA + 'background-color:black!important;position:relative!important;bottom:20px!important;">&nbsp;&nbsp;' + videoMoved + '</div><br /></div><br />'},
handlWin = function(currentWin) {
tmp = '';
var elem = currentWin.document.getElementsByTagName('video'), currLoc = currentWin.location;
if(elem.length > 0) {
if(currLoc.hostname.indexOf('youtu') != -1 && (tmp = currLoc.toString().match(YoutubeID)) && tmp[1].length == 11) {
play(cbu.getPrefs("CB.video") == "videotoplaylist" ? 'https://www.youtube.com/embed/' + tmp[1] : 'https://www.youtube.com/watch?v=' + tmp[1]);
videoMovedbox = currentWin.document.createElement('videoMoved');
videoMovedbox.innerHTML = innerA + innerB + 'top:-15px!important;"><b>' + videoMoved + '</b></div>';
loadURI(stopPl);
currentWin.document.getElementById('eow-title').appendChild(videoMovedbox);
return true;
};
for(i = 0; i < elem.length; i++) {
if(((tmp = getSrc(elem[i].parentNode, currLoc)) && tmp.length > 2) || (i == 0 && currentWin.document.body.innerHTML.substring(0, 7) == '<video ' && (tmp = currLoc.toString()))) {
videoMovedbox = currentWin.document.createElement('videoMoved');
videoMovedbox.innerHTML = innerA + innerB + 'top:20px!important;background-color:black!important;">' + videoMoved + '</div>';
play(tmp);                
if(currLoc.hostname == 'www.youtube.com') {
elem[i].parentNode.parentNode.appendChild(videoMovedbox);
} else {
elem[i].parentNode.appendChild(videoMovedbox);
};
elem[i].src = '';
try {
elem[i].load()
} catch(e) {};
return true;
}
}
};

currentWin._elems = currentWin.document.getElementsByTagName('iframe');
if(currentWin._elems.length > 0) {
for(currentWin._iCounter = 0; currentWin._iCounter < currentWin._elems.length; currentWin._iCounter++) {
if((currentWin._elems[currentWin._iCounter].src.indexOf('youtube.com') > -1) && (tmp = currentWin._elems[currentWin._iCounter].src.match(YoutubeID)) && (tmp[1].length == 11)) {
play(cbu.getPrefs("CB.video") == "videotoplaylist" ? 'https://www.youtube.com/embed/' + tmp[1] : 'https://www.youtube.com/watch?v=' + tmp[1]);
currentWin._elems[currentWin._iCounter].outerHTML = ytIMGouter(tmp[1]);
return true;
};
if(currentWin._elems[currentWin._iCounter].clientWidth > 80 && currentWin._elems[currentWin._iCounter].clientHeight > 40 && handlWin(currentWin._elems[currentWin._iCounter].contentWindow))return true;
}
};

elem = currentWin.document.getElementsByTagName('object');
currLoc = currentWin.location;
if(elem.length == 0) {
elem = currentWin.document.getElementsByTagName('embed')
};
if(elem.length > 0) {
for(i = 0; i < elem.length; i++) {
if(elem[i].innerHTML.indexOf('youtu') != -1 && (tmp = elem[i].innerHTML.match(YoutubeID)) && tmp[1].length == 11) {
play(cbu.getPrefs("CB.video") == "videotoplaylist" ? 'https://www.youtube.com/embed/' + tmp[1] : 'https://www.youtube.com/watch?v=' + tmp[1]);
elem[i].outerHTML = ytIMGouter(tmp[1]);
return true;
} else {
if(elem[i].clientWidth > 80 && elem[i].clientHeight > 40) {
if(((tmp = getSrc(elem[i].parentNode, currLoc)) || (tmp = getLink(elem[i], currLoc))) && tmp.length > 2) {
play(tmp);
elem[i].outerHTML = innerA + 'background-color:black!important;bottom:20px!important;">&nbsp;&nbsp;' + videoMoved + '</div>';
return true;
};
};
}
};
};
return false;
};

this.onclick = this.oncontextmenu = e => {
if (e.target != this) return;
if(e.button == 0) {
if(cbu.getPrefs("CB.video").substring(0,6) == "videom"){
elem = content.document.getElementsByTagName('object');
if(elem.length == 0) {
elem = content.document.getElementsByTagName('embed')
};

resizeObjs(elem);
resizeObjs(content.document.getElementsByTagName('iframe'));
resizeObjs(content.document.getElementsByTagName('video'));
} else {
if(!handlWin(content))custombuttons.alertSlide1(noFound);
}
};
if ( e.button == 2 && !e.ctrlKey && !e.shiftKey && !e.altKey && !e.metaKey ) { // ПКМ
e.preventDefault();
var file = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsIFile);
file.initWithPath('D:\\GOMPlayer\\GOM.exe');
var process = Cc["@mozilla.org/process/util;1"].createInstance(Ci.nsIProcess);
var link = gClipboard.read();
var args = [link,"/play"];
process.init( file );
process.run( false, args, args.length );
}
};
this.oncontextmenu = e => e.target != this ? menu.hasAttribute("context")
    : e.ctrlKey || e.shiftKey || e.altKey || e.metaKey || (
        e.detail != 1 ? menu.hidePopup() : !!menu.openPopup(this, "after_start")
    );
custombuttons.alertSlide1 = function(sTitle) {
var as = Components.classes["@mozilla.org/alerts-service;1"].getService(Components.interfaces.nsIAlertsService);
as.showAlertNotification('chrome://global/skin/icons/information-16.png', "", sTitle, false, "", null);
setTimeout(() => as.closeAlert(), 999);
};
this.tooltipText="Л: Видео в плеер\nП: Видео из Clipboard";
function resizeObjs(objs) {
if(!objs) return;
LEVELS = 3;
dir = (cbu.getPrefs("CB.video") == "videomaximize") ? 1 : -1;
for(i = 0; i < objs.length; i++) {
var Width = new Array(LEVELS)
var Height = new Array(LEVELS)
Width[0] = objs[i].clientWidth;
Height[0] = objs[i].clientHeight;
if((Width[0] > (-20 * dir + 100)) && (Height[0] > (-20 * dir + 60))) {
obj = objs[i];
for(var k = 1;
((k < LEVELS) && (obj.parentNode)); k++) {
obj = obj.parentNode
Width[k] = obj.clientWidth;
Height[k] = obj.clientHeight;
};
Width[0] = Width[0] + dir * (Width[0] / 5 | 0);
Height[0] = Height[0] + dir * (Height[0] / 5 | 0);
objs[i].style.width = Width[0] + "px";
objs[i].width = Width[0];
objs[i].style.height = Height[0] + "px";
objs[i].height = Height[0];
obj = objs[i];
for(var k = 1;
((k < LEVELS) && !(objs[i].tagName == 'IFRAME') && (obj.parentNode) && (Width[k]) && (Height[k]) && (Width[k] > (-20 * dir + 100)) && (Height[k] > (-20 * dir + 60))); k++) {
obj = obj.parentNode
Width[k] = Width[k] + dir * (Width[k] / 5 | 0);
Height[k] = Height[k] + dir * (Height[k] / 5 | 0);
obj.style.width = Width[k] + "px";
obj.width = Width[k];
obj.style.height = Height[k] + "px";
obj.height = Height[k];
}
}
};
};

function restProtHost(lnkR, curLoc) {
if(lnkR.length==0)return '';
let tr = lnkR.replace(/^:\/\//, curLoc.protocol + "//");
if(!tr.match(/^https?:\/\//i)){
lnkR = tr.replace(/^\/+/, '');
if(lnkR.split('/')[0].split('?')[0].split('#')[0].toLowerCase().match(/^(?:[-a-z\d]+\.)+[a-z\d]{2,6}$/)){
tr = curLoc.protocol + '//' + lnkR;
}else{
tr = curLoc.protocol + '//' + curLoc.host + "/" + lnkR;
}
};
return tr;
};

function getSrc(vobj, currentLoc) {
var t = '',
tt = '';
if((((t = vobj.innerHTML.match(/<video.*?\ssrc=(?:(?:'([^']*)')|(?:"([^"]*)")|([^\s]*))/i)) && (t) && (tt = t[1] || t[2] || t[3]) && tt.indexOf('blob:') == -1 ) || ((t = vobj.innerHTML.match(/<source.*?\ssrc=(?:(?:'([^']*)')|(?:"([^"]*)")|([^\s]*)).*?\stype=['"]?video\//i)) && (t) && (tt = t[1] || t[2] || t[3]))) && tt.length > 2 && tt.indexOf('blob:') == -1 ) {
if(tt.indexOf(".mp4/?") == -1) {
tt = tt.replace(/&amp;/g, "&")
};
t = restProtHost(tt, currentLoc);
return t;
};
return '';
};

function getLink(obj, curLocation) {


if(!obj || !obj.tagName) return '';
var flashvars = '',
//        src = '',
q = obj.tagName.toLowerCase();

var getParam = function(e, n) {
var v = '',
r = new RegExp('^(' + n + ')$', 'i'),
param = e.getElementsByTagName('param');
for(var igp = 0, p; p = param[igp]; igp++) {
if(p.hasAttribute('name') && p.getAttribute('name').match(r)) {
v = p.getAttribute('value');
break
};
};
return v;
};


if(q == 'object') {
//        src = obj.getAttribute('data') || obj.getAttribute('src') || getParam(obj, 'movie|data|src|code|filename|url') || (obj.getElementsByTagName('embed').length > 0 ? obj.getElementsByTagName('embed')[0].getAttribute('src') : '');
flashvars = getParam(obj, 'flashvars');
} else if(q == 'embed') {
//        src = obj.getAttribute('src');
flashvars = obj.getAttribute('flashvars');
} else return '';


if(!flashvars) return '';
//   src = restProtHost(src, curLocation);

var restPath = function(f, s) {
return(f.substring(0, 4) == 'http') ? f : s.replace(/[#?].*$/, '').replace(/[^\/]*$/, f)
};

function videoLinkExtract(fl) {
//alert(fl);
var linkArr = [],
outLinks = [],
jj = 0,
lba = '',
lbb = '',
decodeURL = gBrowser.currentURI.spec; {
try {
return decodeURIComponent(s)
} catch(e) {
return unescape(s)
}
};

for(var ij = 0; ij < 3; ij++) {
lba = lba + String.fromCharCode(parseInt((Math.random() * 15 + 1) + '', 10));
lbb = lbb + String.fromCharCode(parseInt((Math.random() * 15 + 16) + '', 10));
};

function pushWithMerit(lnk) {

var merit = -11;
if(lnk.match(/^https?:\/\//i)) merit = merit + 40;
if(outLinks.length == 0) merit = merit + 1;
if(lnk.match(/^\//)) merit = merit + 7;
if(lnk.match(/^\/\//)) merit = merit + 30;
if(lnk.match(/240p([^a-z]|$)/i)) merit = merit + 1;
if(lnk.match(/[^a-z]240([^a-z0-9]|$)/i)) merit = merit + 1;
if(lnk.match(/360p([^a-z]|$)/i)) merit = merit + 3;
if(lnk.match(/[^a-z]360([^a-z0-9]|$)/i)) merit = merit + 3;
if(lnk.match(/480p([^a-z]|$)/i)) merit = merit + 5;
if(lnk.match(/[^a-z]480([^a-z0-9]|$)/i)) merit = merit + 5;
if(lnk.match(/720p([^a-z]|$)/i)) merit = merit + 7;
if(lnk.match(/[^a-z]720([^a-z0-9]|$)/i)) merit = merit + 7;
if(lnk.match(/\.mp4([^a-z]|$)/i)) merit = merit + 8;
if(lnk.match(/_hd([^a-z]|$)/i)) merit = merit + 6;
if(lnk.match(/\.(jpg|xml)([^a-z]|$)/i)) merit = merit - 40;
if(merit > 0) outLinks.push(merit + lba + lnk);
Services.console.logStringMessage('merit:'+merit+' lnk->'+lnk);
};

linkArr.push(fl);
while(linkArr.length > jj && jj < 30) {

var testPaths = [];
testPaths = linkArr[jj].split(/(\.(?:flv|mp4|m3u8))/i);
if(testPaths[testPaths.length - 1] == '') testPaths.pop();

for(k = 1; k < testPaths.length; k = k + 2) {

if(testPaths[k - 1].indexOf(lba) > -1) {
pref = testPaths[k - 1];
} else {
var testAboutDom = testPaths[k - 1].toLowerCase().split(/(https?:\/\/)/); 
if(testAboutDom[testAboutDom.length - 1]=='') testAboutDom.pop();
var pTest = testAboutDom[testAboutDom.length - 1].split(/(\?[^\?]*?&)/);
if(pTest.length>2){
pTest.pop();
pTest.pop();
};
testAboutDom[testAboutDom.length - 1] = pTest.join('');
pref = testPaths[k - 1].substring(testAboutDom.join('').lastIndexOf("&") + 1);
};

t2 = pref.lastIndexOf(lbb);
if(t2 > -1) {
pref = pref.substring(t2 + 3);
} else {

t2 = pref.lastIndexOf('{"');
if(t2 > -1) pref = pref.substring(t2 + 2);
t2 = pref.lastIndexOf('["');
if(t2 > -1) pref = pref.substring(t2 + 2);
t2 = pref.lastIndexOf(',"');
if(t2 > -1) pref = pref.substring(t2 + 2);
t2 = pref.toLowerCase().lastIndexOf('"http://');
if(t2 > -1) pref = pref.substring(t2 + 1);
t2 = pref.toLowerCase().lastIndexOf('"https://');
if(t2 > -1) pref = pref.substring(t2 + 1);
t2 = pref.toLowerCase().lastIndexOf(',http://');
if(t2 > -1) pref = pref.substring(t2 + 1);
t2 = pref.toLowerCase().lastIndexOf(',https://');
if(t2 > -1) pref = pref.substring(t2 + 1);
t2 = pref.toLowerCase().lastIndexOf(';http');
if(t2 > -1) pref = pref.substring(t2 + 1);
t2 = pref.toLowerCase().lastIndexOf('*https://');
if(t2 > -1) pref = pref.substring(t2 + 1);
t2 = pref.toLowerCase().lastIndexOf(' or ');
if(t2 > -1) pref = pref.substring(t2 + 4);

pref = pref.substring(pref.split('/')[0].toLowerCase().split('%2f')[0].lastIndexOf('=') + 1);

}

if(pref.length > 0) {

if(pref.split('?')[0].toLowerCase().match(/%[2-3][0-9a-f]/)) {

t2 = pref.indexOf('"')
if(t2 > -1) pref = pref.substring(t2 + 1);
suff = testPaths[k + 1] ? testPaths[k + 1].split('&')[0].split('"')[0].split(';')[0].split(/,http/i)[0] : '';
if((suff != testPaths[k + 1]) || (testPaths.length < k + 3)) {
if(testPaths.length > k + 1) {
testPaths[k + 1] = ((pref == testPaths[k - 1]) ? '' : '&') + testPaths[k + 1].substr(suff.length)
};
t2 = pref.lastIndexOf(lba);
if(t2 > -1) pref = pref.substring(t2 + 3)
linkArr.push(decodeURL(pref + testPaths[k] + suff));

} else {
testPaths[k + 1] = (pref == testPaths[k - 1] ? '' : lbb) + pref + testPaths[k] + suff
}
} else {
suff = testPaths[k + 1] ? testPaths[k + 1].split(';')[0].split('"]')[0].split('"}')[0].split('",')[0].split(/,https?:\/\//i)[0].split('*https://')[0].split(' or ')[0] : '';
t2 = suff.indexOf('&');
if((t2 > -1) && (pref != testPaths[k - 1])) {
if(t2 == 0) suff = '';
if(suff.charAt(0) != '?') suff = suff.split(/(&[^&]+=https?:\/\/)/i)[0];
};
if((suff != testPaths[k + 1]) || (testPaths.length < k + 3)) {
if(testPaths.length > k + 1) {
testPaths[k + 1] = ((pref == testPaths[k - 1]) ? '' : '&') + testPaths[k + 1].substr(suff.length)
};
t2 = pref.lastIndexOf(lba);
if(t2 > -1) pref = pref.substring(t2 + 3);
pushWithMerit(pref + testPaths[k] + suff);

} else {
testPaths[k + 1] = lba + (pref == testPaths[k - 1] ? '' : lbb) + pref + testPaths[k] + suff
}
}
}
};
jj = jj + 1;
};

if(outLinks.length == 0) return '';
function srt(a, b) {
a = parseInt(a.substr(0, a.indexOf(lba)), 10);
b = parseInt(b.substr(0, b.indexOf(lba)), 10);
if(a < b) return 1;
if(a > b) return -1;
return 0
};
outLinks.sort(srt);
outLinks[0] = outLinks[0].substr(outLinks[0].indexOf(lba) + 3)
if(outLinks[0].indexOf('_hq.mp4/?time=') > 0) outLinks[0] = outLinks[0].replace(/&/g, '&amp;');
return outLinks[0];
};
ol = videoLinkExtract(flashvars);
if(!ol) return '';
//    ol = ol.replace(/^:?\/\//, curLocation.protocol + "//");
//    return restPath(ol, src);
return restProtHost(ol, curLocation);
};


var menu = self.appendChild(document.createXULElement("menupopup"));
self.image = "moz-icon://file://" + path;
var playerName = path.split("\\").pop().replace(".exe","");
self.label = "Открыть видео в " +sysPlayerName;
setTimeout(() => {
Menu_n_TooltipTxts.forEach((m) => {
if("separator" in m) {
menu.appendChild(document.createXULElement("menuseparator"));
return
};
var mItem = document.createXULElement("menuitem");
mItem.setAttribute("label", m.label);

if("radio" in m) {
mItem.setAttribute("type", "radio");
mItem.setAttribute('checked', cbu.getPrefs("CB.video") == m.value);
if(cbu.getPrefs("CB.video") == m.value) {
self.tooltipText = m.tooltipTxt;
}
mItem.onclick = () => {
cbu.setPrefs("CB.video", m.value);
tmp = (self.image == imgFlashToPlayer || self.image == imgFlashMinimize ||  self.image == imgFlashMaximize);
if(m.value.substring(0,9)=='videotopl'){
self.image = tmp ? imgFlashToPlayer : imgHTML5ToPlayer;
} else if(m.value=='videominimize') {
self.image = tmp ? imgFlashMinimize : imgHTML5Minimize;
} else self.image = tmp ? imgFlashMaximize : imgHTML5Maximize;
self.tooltipText = m.tooltipTxt;
};
}
if("checkbox" in m) {
mItem.setAttribute('type', 'checkbox');
mItem.setAttribute('checked', (self.image == imgFlashToPlayer || self.image == imgFlashMinimize ||  self.image == imgFlashMaximize ));
mItem.onclick = function(e) {
e.stopPropagation();
e.preventDefault();
if(e.button == 0) toggleFlash();
}
}
menu.appendChild(mItem);
});
menu.onclick = function(e) {
e.stopPropagation();
if(e.button > 0) e.preventDefault();
};
}, 100);

var contextMenu = document.getElementById("contentAreaContextMenu");
var menuitem = contextMenu.insertBefore(document.createXULElement("menuitem"), document.getElementById("context-savelink"));
menuitem.setAttribute("label", "Открыть в " +sysPlayerName);      
menuitem.setAttribute("class", "menuitem-iconic");
menuitem.setAttribute("image", "moz-icon://file://" + path); 
menuitem.onclick = () => play(gContextMenu.linkURL || gContextMenu.mediaURL);
addEventListener("popupshowing", ()=> menuitem.hidden = !gContextMenu.onLink && !gContextMenu.onVideo && !gContextMenu.onPlainTextLink, false, contextMenu);
addDestructor(()=> menuitem.remove() );

onclick = () => {
e.preventDefault();
var vurl = gContextMenu.mediaURL, videoelem = gContextMenu.target;
if(videoelem && videoelem.nodeName.toLowerCase() == 'video') {
if(content.location.hostname.indexOf('youtu') != -1 && (tmp = content.location.toString().match(YoutubeID)) && tmp[1].length == 11) {
play(vurl);
videoMovedbox = content.document.createElement('videoMoved');
videoMovedbox.innerHTML = innerA + innerB + 'top:-15px!important;"><b>' + videoMoved + '</b></div>';
loadURI(stopPl);
content.document.getElementById('eow-title').appendChild(videoMovedbox);
return;
};

if(content.location.hostname == 'www.youtube.com') {
videoelem.parentNode.parentNode.appendChild(videoMovedbox);
} else {
var inFrameHref = inFrameWin.location.href, found = false;
if(inFrameWin.location.hostname == 'www.youtube.com' && (tmp = inFrameHref.match(YoutubeID)) && tmp[1].length == 11){//и значит во фрейме
elem = inFrameWin.parent.document.getElementsByTagName('iframe');
if(elem.length > 0) {
for(i = 0; i < elem.length; i++) {
if(elem[i].contentWindow == inFrameWin) {
elem[i].outerHTML = ytIMGouter(tmp[1]);
found = true;
break;
};
};
};
if(!found)inFrameWin.document.body.innerHTML = ytIMGouter(tmp[1]);
return;
};
videoelem.parentNode.appendChild(videoMovedbox);
};
videoelem.src = '';
try {
videoelem.load()
} catch(e) {};
} else play(vurl);
};

addEventListener("popupshowing", () => {
mItem.hidden = !gContextMenu.onVideo || !gContextMenu.mediaURL;
mItem2.hidden = !gContextMenu.linkURL;
mItem3.hidden = framItem.hidden || gContextMenu.target.ownerDocument.location.hostname.indexOf('youtube.com') == -1;
}, false, contextMenu);
addDestructor(() => {mItem.remove();mItem2.remove();mItem3.remove()});


function play(link) {

var file = Services.dirsvc.get('CurProcD', Ci.nsIFile);
var MozExeDir = file.path.split('\\').slice(0,-1).join('\\');
file.initWithPath(path);
if(!file.exists()) {
custombuttons.alertBox("File not found!", MozExeDir + Path);
return;
};
var process = Cc["@mozilla.org/process/util;1"].createInstance(Ci.nsIProcess);
var args = [link,"/pause"];
process.init( file );
process.run( false, args, args.length );
};

Отсутствует

 

№1466201-06-2020 22:45:45

shulep22
Участник
 
Группа: Members
Зарегистрирован: 01-06-2020
Сообщений: 7
UA: Chrome 83.0

Re: Custom Buttons

solombala
она у меня давно,не помню уже)))спасибо,сейчас попробую.

Отсутствует

 

№1466302-06-2020 11:48:26

Dumby
Участник
 
Группа: Members
Зарегистрирован: 12-08-2012
Сообщений: 2217
UA: Firefox 52.0

Re: Custom Buttons

Andrey_Krropotkin пишет

и что-то перестал работать такой код

Код это хорошо, но хотелось бы подробнее, что перестало работать.
Типа на что конкретно обратить внимание, ну то есть STR.
А то посмотрел, и то, что там прописано, вроде, работает.
____________


Но косяк с этой версией CB всё же есть.
Прошляпил, что вырезали <!ENTITY> для пункта меню «Персонализация…»,
и на en-US Firefox 78, это ставит парсер враскоряку.


Nightly у меня ru, а у локализаторов такая интересная политика,
что в .ftl'ки перевод добавляется, но из .dtd'шек не удаляется,
поэтому кажется, что всё в порядке. Хотя да, должен был быть внимательней.


Ну что ж, придётся собрать ещё версию, если может у кого 78 и не ru.
custom_buttons-0.0.7.0.0.15a1-fx-paxmod.xpi
custom_buttons-0.0.7.0.0.15a1-fx-bootstrap.xpi

Отсутствует

 

№1466402-06-2020 12:21:34

Andrey_Krropotkin
Участник
 
Группа: Members
Зарегистрирован: 11-11-2011
Сообщений: 482
UA: Firefox 76.0

Re: Custom Buttons

Dumby в консоли пишет SyntaxError: unexpected token: identifier button.js:1:36 в редакторе ошибку не выделяет. Если поставить custom_buttons-0.0.7.0.0.15a1-fx-paxmod.xpi пишет:
SyntaxError: missing } in compound statement button.js:12:14
note: { opened at line 6, column 23button.js:6:23
ссылается на первую строчку кода и на // End editable preferences

Отсутствует

 

№1466502-06-2020 12:38:33

voqabuhe
Участник
 
Группа: Members
Зарегистрирован: 06-12-2011
Сообщений: 3231
UA: Firefox 77.0

Re: Custom Buttons

Andrey_Krropotkin
А что это за кнопка?

Отсутствует

 

№1466602-06-2020 12:44:19

Dumby
Участник
 
Группа: Members
Зарегистрирован: 12-08-2012
Сообщений: 2217
UA: Firefox 52.0

Re: Custom Buttons

Andrey_Krropotkin
Странно, ничего подобного увидеть у себя не получается.
Может где-то где-то какой-то глюк прописался и залип.


Попробуй удалить кнопку, поперезапускаться с очисткой startupCache,
и создать кнопку заново, возможно, сначала, в другом месте.
Больше никаких идей нет.

Отсутствует

 

№1466702-06-2020 13:11:57

Andrey_Krropotkin
Участник
 
Группа: Members
Зарегистрирован: 11-11-2011
Сообщений: 482
UA: Firefox 76.0

Re: Custom Buttons

Dumby с очисткой startupCache глюк пропал, но что-то раньше никогда при установке новой custom_buttons не требовалось очистить кеш, спасибо.
voqabuhe добавляет в контекстное меню СВ кнопок пункт - переместить кнопку. Перемещает любую СВ кнопку, не открывая персонализацию вслед за выбранной СВ кнопкой . В контекстном меню СВ кнопки, которую надо переместить, выбираешь пункт - переместить кнопку. Затем выбираешь кнопку, за которой она должна находиться и жмешь по ней правой кнопкой мыши и кнопка перемещается

Отсутствует

 

№1466802-06-2020 14:27:03

voqabuhe
Участник
 
Группа: Members
Зарегистрирован: 06-12-2011
Сообщений: 3231
UA: Firefox 77.0

Re: Custom Buttons

Dumby пишет

custom_buttons-0.0.7.0.0.15a1-fx-paxmod.xpi
custom_buttons-0.0.7.0.0.15a1-fx-bootstrap.xpi

Я один не могу скачать/установить?

Отсутствует

 

№1466902-06-2020 14:51:01

Andrey_Krropotkin
Участник
 
Группа: Members
Зарегистрирован: 11-11-2011
Сообщений: 482
UA: Firefox 76.0

Re: Custom Buttons

voqabuhe все скачивается и устанавливается

Отсутствует

 

№1467002-06-2020 15:03:32

voqabuhe
Участник
 
Группа: Members
Зарегистрирован: 06-12-2011
Сообщений: 3231
UA: Firefox 77.0

Re: Custom Buttons

Andrey_Krropotkin
У меня только через VPN скачалось, очевидно надзор бдит. :)

Отсутствует

 

№1467102-06-2020 22:40:01

Dumby
Участник
 
Группа: Members
Зарегистрирован: 12-08-2012
Сообщений: 2217
UA: Firefox 52.0

Re: Custom Buttons

egorsemenov06 пишет

saveImageURL is not defined

Ага, вижу, избавились.
Могу попытаться пробросить аргументы в internalSave(), главное не запутаться.


Попробуй добавить в Save.js перед комментарием
// Сохранить иконку текущего сайта с диалогом сохранения .............

скрытый текст

Выделить код

Код:

if (typeof window.saveImageURL != "function") var saveImageURL = (
	url, name, a3, a4, a5, a6, a7, type, a9, priv, prin
) => internalSave(
	url, null, name, a9, type, a4, a3, null, a6, a7, a5, null, priv, prin
);


84+

Выделить код

Код:

if (typeof window.saveImageURL != "function") var saveImageURL = internalSave.length == 15
	? (url, name, a3, a4, a5, a6, a7, type, a9, priv, prin) =>
		internalSave(url, null, name, a9, type, a4, a3, null, a6, null, a7, a5, null, priv, prin)
	: (url, name, a3, a4, a5, a6, a7, type, a9, priv, prin) =>
		internalSave(url, null, name, a9, type, a4, a3, null, a6, a7, a5, null, priv, prin);
Выделить код

Код:

...
                //wbp.saveURI.length == 9 && splice(args);
                var {length} = wbp.saveURI;
                length >= 9 && splice(args);
                length == 10 && args.splice(3, 0, null);

Отредактировано Dumby (26-11-2020 00:02:22)

Отсутствует

 

№1467202-06-2020 23:54:18

voqabuhe
Участник
 
Группа: Members
Зарегистрирован: 06-12-2011
Сообщений: 3231
UA: Firefox 77.0

Re: Custom Buttons

Dumby
А Cookies Permissions можешь подправить? Опять не открываются Показать исключения..., Показать cookies...

Отредактировано voqabuhe (02-06-2020 23:55:53)

Отсутствует

 

№1467303-06-2020 11:36:17

Dumby
Участник
 
Группа: Members
Зарегистрирован: 12-08-2012
Сообщений: 2217
UA: Firefox 52.0

Re: Custom Buttons

voqabuhe пишет

Опять не открываются Показать исключения..., Показать cookies...

Это Bug 1201243 - Move preferences code from browser/components/preferences/in-content to /browser/components/preferences/
Просто пустопорожние перестановки. Кстати, касается всех любителей открывать
настроечные субдиалоги в окне или во вкладке, поскольку их адреса изменились.
То есть, например, для Cookies Permissions, было/стало
это
chrome://browser/content/preferences/permissions.xhtml
chrome://browser/content/preferences/dialogs/permissions.xhtml
и
chrome://browser/content/preferences/siteDataSettings.xhtml
chrome://browser/content/preferences/dialogs/siteDataSettings.xhtml

можешь подправить?

Нужно править сам cookiesPermissions.js
Пока проверяй, а я пойду отпишусь в теме.

скрытый текст

Выделить код

Код:

...
			//win = window.openDialog("chrome://browser/content/preferences/permissions" + ext, "_blank", "", params);
			var sub = _this.platformVersion >= 77 ? "dialogs/" : "";
			win = window.openDialog("chrome://browser/content/preferences/" + sub + "permissions" + ext, "_blank", "", params);
...
				//win = window.openDialog("chrome://browser/content/preferences/siteDataSettings" + ext, "_blank", "");
				var sub = _this.platformVersion >= 77 ? "dialogs/" : "";
				win = window.openDialog("chrome://browser/content/preferences/" + sub + "siteDataSettings" + ext, "_blank", "");

Отсутствует

 

№1467403-06-2020 13:35:11

voqabuhe
Участник
 
Группа: Members
Зарегистрирован: 06-12-2011
Сообщений: 3231
UA: Firefox 77.0

Re: Custom Buttons

Dumby пишет

Пока проверяй

Да ещё б понять, куда именно его вставить?
Спасибо большое, всё работает.

Отредактировано voqabuhe (03-06-2020 16:28:04)

Отсутствует

 

№1467503-06-2020 15:48:45

Andrey_Krropotkin
Участник
 
Группа: Members
Зарегистрирован: 11-11-2011
Сообщений: 482
UA: Firefox 76.0

Re: Custom Buttons

voqabuhe сделать замены то что "//win = и.тд." на две строчки то что под ним
т.е. для первого случая найти
win = window.openDialog("chrome://browser/content/preferences/permissions" + ext, "_blank", "", params);
и заменить на
var sub = _this.platformVersion >= 77 ? "dialogs/" : "";
win = window.openDialog("chrome://browser/content/preferences/" + sub + "permissions" + ext, "_blank", "", params);
также и для для второго случая

Отредактировано Andrey_Krropotkin (03-06-2020 15:58:29)

Отсутствует

 

Board footer

Powered by PunBB
Modified by Mozilla Russia
Copyright © 2004–2020 Mozilla Russia GitHub mark
Язык отображения форума: [Русский] [English]