Change spellcheck language in my Chrome extension - google-chrome-extension

I'm trying to write a Chrome extension that can switch the spellcheck language. I've searched through the Chrome API's and found the ChromeSetting object in the Types interface. However, I can't find any information on how to use it - e.g. what are the options for the "details" object?
Am I heading down the right path here? If so, does nayone have some examples or extra info that will help me?
Thanks!

Unfortunately, while chrome.types exists, you can't do anything with it.
We can run this code to see:
var c = chrome.types;
alert( Object.keys( c ).join(", ") );
Results:
[null]
This is despite the docs you linked to stating there are some methods available. My guess is it will be completed "someday" when Goog gets around to it.

Related

Why won't my one simple custom user Python snippet '__init__' appear in IntelliSense?

I've spent the last two hours trying to figure this out, but nothing I've found online helps. Either all search results I've found were severely outdated, not relevant to my problem, or didn't work.
I am a complete beginner to Python, so please try to make your suggestions/solutions/answers understandable enough for me (i.e. draw them in crayon if you must.:)) I want the init method to not autocomplete all of this:
__init__(self, *groups: _Group) -> None:
super().__init__(*groups)
I want it to simply autocomplete as "init()" and that's it, nice and clean for what I'm currently doing.
Searching around, looking at other python snippet extension files, and even using a snippet generator, I've
found that this should be the code that I should use:
"__init__ method":
{
"prefix": "__init__",
"body": ["__init__($0)"],
"description": "New __init__ method"
}
I've created a global.code-snippets file and even a python.json file with Configure User Snippets, both of which are located in C:\Users<myusername>\AppData\Roaming\Code\User\snippets. However, it does not show up when I type out init, instead I still get the default suggestions:
Default init suggestions
What am I missing? I didn't think this would be so difficult.
I've looked at https://code.visualstudio.com/docs/editor/userdefinedsnippets, I've tried https://snippet-generator.app/, I've checked out other Python snippet extensions to see how they were written out.
A bit more digging around and using different keyword searches this morning brought me to IntelliSense in Visual Studio Code, and 3/4 of the way down there was Suggestion selection which said to use the editor.suggestSelection setting. Turns out it was disabled. Once I enabled it, both my python.json and global.code-snippet suggestions showed up.

Initiate "Sys" object in vbs

i'm trying to do some stuff in vbscript, and i have to take a screenshot of the screen. I don't want to use an external executable (Auto Screenshot using VBS).
I find a vbs which can be nice (how to take screenshot by vbscript?) but when i use this, it use an object (Sys), but i don't know how to create it.
I find some resources here, but i really don't know how to initiate the object "Sys", apparently it's like already "in" the vbscript, but it doesn't works for me.
I tried some stuff (Set Sys = CreateObject("System") or things like that, but nothing works :(
I hope you'll find something ^^
The question you've referenced looks like a low-quality question. The references to "Sys" that you see appear to be in a product called TestComplete. See How to capture a screenshot using VBScript in TestComplete? You'd need to acquire and install TestComplete to use it, or find another program to capture screenshots instead.

lock preferences in firefox 45.5 on RHEL

I am required to make a custom FireFox profile on a RHEL based system.
most of the configuration are changed inside the FireFox inside the about:config menu.
When I try and lock parameter values using the "mozilla.cfg" file and the "lockPref("", )" function the browser doesn't seem to read those files, I place the file both in: "~/.mozilla/firefox/" and "/usr/lib64/firefox/". I used the http://kb.mozillazine.org/Lock_Prefs guide and some more and still I have no one answer about where those function should be written and how do I check that those functions were loaded.
I would like some clear instructions or a definitive guide that I just couldn't manage to find.
Thanks!
This came up fairly high in a Google search when I was asking the same question, but did not have an answer at the time.
I found the following reference:
https://developer.mozilla.org/en-US/Firefox/Enterprise_deployment
On RHEL7, the files needed to be added to the following locations:
/usr/lib64/firefox/defaults/preferences/autoconfig.js (root:root, 644)
/usr/lib64/firefox/mozilla.cfg (root:root, 644)

Getting echofunc.vim to work

I came across echofunc.vim today (from a link in SO). Since I'm rubbish at remembering the order of function parameters, it looked like a very useful tool for me.
But the documentation is a bit lean on installation! And I've not been able to find any supplementary resources on the internet.
I'm trying to get it running on a RHEL box. I've copied the script into ~/.vim/plugin/echofunc.vim however no prompt when I type in a function name followed by '('. I've tried adding
let g:EchoFuncLangsUsed = ["php","java","cpp"]
to my .vimrc - still no prompting.
I'm guessing it needs to read from a dictionary somewhere - although there is a file in /usr/share/vim/vim70/ftplugin/php.vim, this is the RH default and does not include an explicit function list.
I'm not too bothered about getting hints on the functions/methods I've defined - just trying to get hints for the built-in functions. I can see there is a dictionary file available here which appears to provide the resources required for echofunc.vim, I can't see how I set this up.
TIA,
It expects a tags file, the last line of the description describes exactly how to generate it:
ctags -R --fields=+lS .
It works here with PHP but not with JS. Your mileage may vary.
I didn't know about this plugin, thanks for the info.
You should try phpcomplete.vim, it shows a prototype of the current function in a scratchpad. It is PHP only, though.

Method for Debugging Userscripts in Chrome

I've attempted to make some modifications to a userscript to enable it to work under Chrome, but when I drag it into Chrome's window in order to install it, a dialog pops up and says 'Invalid Script Header'.
I've tried to use the Developer Tools, and built-in Javascript Console, to debug any errors occurring, but nothing appears to list any information.
Console.app does not list anything meaningful, except for the same error message I already know.
[0x0-0x2d02d].com.google.Chrome: [346:1547:16686819618022:ERROR:extension_error_reporter.cc(55)] Extension error: Invalid script header.
How can I reasonably debug this error message and figure out what about the header is incorrect?
I'm using Chrome 15.0.861.0 on the dev channel, under OS 10.7 Lion.
I finally stumbled across the answer to this question, amusingly via a Chromium Bug Report.
As it turns out, the answer to my question was in the (significantly brief) Userscript Documentation for Chrome page.
With Greasemonkey-style #include rules, it is not possible for Chrome to know for certain the domains a script will run on (because google.* can also run on google.evil.com). Because of this, Chrome just tells users that these scripts will run on all domains, which is sometimes scarier than necessary. With #match, Chrome will tell users the correct set of domains a user script will run on.
As it turns out, I had been using #match http://*musicbrainz.org in an attempt to match www.musicbrainz.org as well as musicbrainz.org, but per the quoted text, that doesn't save you from accidentally matching evilmusicbrainz.org. So, my solution was to use two lines:
#match http://*.musicbrainz.org
#match http://musicbrainz.org
Type:
debugger;
Somewhere in the code, and the Web Inspector will pop up in that location. I have answered similar question here Chrome debugger inject javascript
I figured out while I got the same error message ( INVALID SCRIPT HEADER ) that it accoured cause of a typo between the // ==UserScript== Header info.
wronge line
// #run-at document.end
corrected line
// #run-at document-end

Resources