bayas

Members
  • Content count

    32
  • Joined

  • Last visited

Community Reputation

22 Excellent

About bayas

  • Rank
    Freshman
  1. Your issue is not related to the ViolentMonkey. You must observe some elements in javascript to change some functionalities. Here is an example for your need. // ==UserScript== // @name Youtube // @namespace Violentmonkey Scripts // @include http://*.youtube.* // @include https://*.youtube.* // @grant none // @run-at document-end // ==/UserScript== console.log('My Script Injected!'); function myVideoFunction() { console.log('New Youtube video loading..'); var video = document.querySelector('#player video'); video.playbackRate = 10.0; } var observer = new WebKitMutationObserver(function (mutations) { mutations.forEach(function (mutation) { for (i = 0; i < mutation.addedNodes.length; i++) { if (mutation.addedNodes[i].id === 'watch7-main-container') { myVideoFunction(); } } }); }); var ytPage = document.getElementById('page'); observer.observe(ytPage, { childList: true, subtree: true });
  2. Actually, extension's page script does not show up in the content scripts section.
  3. Hello Maxthon, Some features of extension that I realized are not supported anymore in this core (Chrome 55). Do you think you are going to resolve them in the official release. - I cannot inspect the page script of extension in the "Content Scripts" section. - "mx.app.runtime.AppAction.activate()" does not work anymore. (Showing Panel from the page script). It was the most important thing that makes Maxthon a better Browser as compared to other chrome-based Browsers.
  4. You can only send or receive a message from one action (toolbar script) to another (page script) or vice versa. For example; Toolbar script: var mxRuntime = window.external.mxGetRuntime(); function getMessageFromPage(obj) { console.log('message: ' + obj); } mxRuntime.listen('messageFromPage', getMessageFromPage); var button = document.getElementsByTagName("button")[0]; button.onclick = function(e) { mxRuntime.post('messageFromToolbar', 'Hi from Toolbar!'); } Page script: var mxRuntime = window.external.mxGetRuntime(); function getMessageFromToolbar(obj) { console.log('message: ' + obj); } mxRuntime.listen('messageFromToolbar', getMessageFromToolbar); mxRuntime.post('messageFromPage', 'Hi from Page Script!');
  5. help with checkbox/variable/newtab

    In javascript environment, If your variable is not a boolean, every value of variable represents true except "0" string, undefined or null value. You must compare storage value to what you need. var mxRuntime = window.external.mxGetRuntime(), mxStorage = mxRuntime.storage, mxTabs = mxRuntime.create('mx.browser.tabs'); var activate = mxStorage.getConfig('openTab') == 'true'; mxTabs.newTab({ url: url, activate: activate, position:"afterCurrrent" });
  6. ViewPage 3

    @Galileusz I've read it before. I wanted to say: it should be packaged alongside the zip format to be able to install this extension more easily.
  7. ViewPage 3

    I fixed some bugs, now all beatufiers works for styles and sources. ViewPage3.0.2.mxaddon
  8. ViewPage 3

    Why did not you share it as a package. Anyway I packed it for you ViewPage3.0.2.mxaddon
  9. show extensions

    If you just want to download the videos on Youtube. Install Violentmonkey and then go to KeepVid site and install "KeepVid Helper" script.
  10. Cannot login to extension page

    3 months later and still no solution...
  11. Cannot login to extension page

    Still cannot login.
  12. Don't use local html file like panel.$.htm After the release of Maxthon 4.9.x, extension framework hasn't supported them. You must do it manually. For example; en.ini [lang] app.title=Title app.description=Description panel.htm <!DOCTYPE HTML> <html lang="en-US"> <head> <meta charset="UTF-8"> <title data-lang="app.title">Title</title> </head> <body> <div data-lang="app.description">Description</div> </body> <script type="text/javascript" src="js/jquery.min.js"></script> <script> var rt = window.external.mxGetRuntime(); var i18n = rt.locale.t; jQuery(document).ready(function() { // localize. jQuery("[data-lang]").each(function(index, item) { var key = jQuery(this).attr("data-lang"); jQuery(this).text(i18n(key)); }); }); </script> </html>
  13. You should create a background service in your extension in order to catch properly all of panel events. 1- Define service file in your def.json [ { . . "service": { main: "service.htm", debug: false } . . } ] 2- Catch events in service.htm. <!DOCTYPE HTML> <html lang="en-US"> <head> <meta charset="UTF-8"> <script> var rt = window.external.mxGetRuntime(); rt.onAppEvent = function (obj) { switch (obj.type) { case "ACTION_START": // panel started. break; case "ACTION_STOP": // panel stopped. break; case "ACTION_SHOW": // panel is shown. break; case "ACTION_HIDE": // panel is hidden. break; case "ERROR": console.log(obj.errorMessage); break; case "LOCALE_CHANGED": // locale changed. break; default: // do nothing. } }; </script> </head> <body> </body> </html> You can also debug your service by changing debug parameter.
  14. http://extension.maxthon.com/server/go.php?guid={YOUR-EXTENSION-GUID-NUMBER-HERE}