greasyfork | An online repository of user scripts
kandi X-RAY | greasyfork Summary
kandi X-RAY | greasyfork Summary
Greasy Fork is an online repository of user scripts and user styles.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Updates all the scripts in the database .
- Renders the list of scripts .
- Returns a JSON representation of this Entity .
- Update required attributes
- Update a script
- This function update a blocked script .
greasyfork Key Features
greasyfork Examples and Code Snippets
Community Discussions
Trending Discussions on greasyfork
QUESTION
Code contains errors: Uncaught SyntaxError: Unexpected token 'if' at undefined:18:22
When uploading to greasyfork I've got that error. The javascript file is:
...ANSWER
Answered 2022-Jan-28 at 07:38Conditional (ternary) operator may help:mynew.innerHTML = (!(myhtml == null)) ? myhtml : 'A random ' + tobuild + '.';
QUESTION
I use an online music player called "Netease Cloud Music", and I have multiple playlists in my account, they hold thousands of tracks and are very poorly organized and categorized and held duplicate entries, so I want to export them into an SQL table to organize them.
I have found a way to view the playlists without using the client software, that is, clicking the share button on top of the playlist page and then click "copy link".
But opening the link in any browser other than the client, the playlist will be limited to 1000 tracks.
But I have found a way to overcome it, I installed Tampermonkey and then installed this script.
Now I can view full playlists in a browser.
This is a sample playlist.
The playlists look like this:
The first column holds the songtitle, the second column holds the duration, the third column holds the artist, and the last column holds the album.
The text in the first, third and fourth columns are hyperlinks to the song, artist and album pages respectively.
I don't know a thing about html but I managed to get its data structure.
The thing we need is the table located at xpath //table/tbody
, each row is a childnode of the table named tr(xpath //table/tbody/tr
).
this is a sample row:
...ANSWER
Answered 2021-Jun-07 at 07:39The simplest answer is that you have to add some delay after opening the page with Firefox.get('https://music.163.com/#/playlist?id=158624364&userid=126762751')
before getting the elements with Firefox.find_elements_by_xpath('//table/tbody/tr')
to let the elements on the page loaded. It takes few moments.
So, you can simply add a kind of time.sleep(5)
there.
The better approach is to use expected conditions instead.
Something like this:
QUESTION
I'm making a website to post some scripts that I made, I would like to create a button on my page to dynamically install the UserScript with Tampermonkey or Greasemonkey, just like in Greasyfork.
Page example: Script example
...ANSWER
Answered 2021-Mar-01 at 19:58You can try to trigger a download using a hidden element with a
download
attribute set to the filename ending in .user.js
. You might need to enable some settings in your browser to detect downloading opening of UserScripts.
Note: You may need to send the text to a server (PHP, Node, etc...), save the file as *.user.js
and then create an </code> with an <code>href</code> poiting to the filename on the server to trigger a proper file download/install. When you install a script on Greasyfork, it downloads a <code>*.user.js</code> file that is hosted on their server(s). The filename that is downloaded fits the following the pattern:</p>
<blockquote>
<p><code>https://greasyfork.org/scripts/<ID>-script-name/code/Script%20Name.user.js</code></p>
</blockquote>
<p>Downloading scripts from the client or local file system is frowned upon in modern web dev.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>const download = (content, mimeType, filename) => {
const
a = document.createElement('a'),
blob = new Blob([content], {type: mimeType}),
url = URL.createObjectURL(blob);
a.setAttribute('href', url);
a.setAttribute('download', filename);
a.click();
console.log(`Downloading: ${filename}`);
};
const extractFilenameFromScript = (script) => {
const [, scriptName] = script.match(/^\/\/\s*@name\s+(.+)$/m);
return `${scriptName.replace(/[^a-z0-9]+/ig, '-').toLowerCase()}.user.js`;
};
const downloadScript = () => {
const script = document.querySelector('.user-script').textContent.trim();
const filename = extractFilenameFromScript(script);
download(script, 'text/javascript', filename);
};
document.querySelector('.download-btn').addEventListener('click', downloadScript);</code></pre>
<pre class="snippet-code-css lang-css prettyprint-override"><code>.user-script {
width: 100%;
height: 8em;
}</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code><textarea class="user-script">// ==UserScript==
// @name My Awesome Script
// @namespace com.stackoverflow.questions
// @version 1.0.0
// @description An example UserScript to download
// @author Mr. Polywhirl
// @match https://stackoverflow.com/questions/66428142
// @grant none
// ==/UserScript==
(function() {
'use strict';
alert('Hello World');
})();
</textarea>
<button class="download-btn">Download</button></code></pre>
</div>
</div>
</p>
QUESTION
I use Active Storage on my Rails site with AWS. After upgrading to 6.1, I'd like to configure public access per the guide so my images have permanent URLs.
I've determined that I need to keep the existing service as-is so previously uploaded images continue to work. I've created a new service and configured the app to use it like this.
Previous images continue to work like this, but new image uploads result in Aws::S3::Errors::AccessDenied. Note that the credentials used are exactly the same as in the previous, working, non-public service. The guide mentions that the bucket needs to have the proper permissions, but not what exactly needs to be set.
Looking in AWS, the section "Block public access (bucket settings)" is all set to "Off". In "Access control list (ACL)", "Bucket owner (your AWS account)" has "List, Write" for both "Objects" and "Bucket ACL". No other permissions are listed. I've tried changing "Everyone (public access)" to include "List" for "Objects" and "Read" for "Bucket ACL" - doesn't seem to solve the problem.
How do I get public URLs working with Active Storage?
...ANSWER
Answered 2020-Dec-19 at 16:51The permission you need when switching from private access to public is PutObjectAcl
. Adding this in the IAM Management Console makes it work.
In addition, rather than creating a new service, you can mark all images in the existing service as public-readable via the UI or via a script.
QUESTION
I create an Object that includes 3 Objects, one of which includes three Objects, and I want to get each one of them to set the value.
And I do not know whether the type of object to divide, it seems all are Object.
I try to do like this, traverse the first time to recognize the Object and the Array, then traverse twice and the third time in depart, but the console shows an error.
>Cannot set property 'www.google.com' of undefined
TypeError: Cannot set property 'www.google.com ' of undefined
at eval (userscript.html?name=
at Array.forEach ()
The original script excludes the four levels nesting Object The browser search tool
...ANSWER
Answered 2020-Dec-11 at 15:40Cannot set property 'www.google.com' of undefined TypeError: Cannot set property 'www.google.com ' of undefined
The error is thrown because hostCustomMap is not a property of iconsData.
In your code you set a variable named hostCustomMap at the end, this should be a property of the object iconsData. Like in the original script.
Like this:
QUESTION
I put three arrays in an object, and I want to get each one of them to set the value, and I try Object.keys(obj).forEach(function(key){
to traverse it, it gets the value of an object, but I can not get the third level of the item.
And also, I try const iterate = (obj)
, it does not work well.
Whether the iterate function can get the item then set the value or use .forEach to get it.
...ANSWER
Answered 2020-Dec-10 at 19:34Object.keys(object)
return an array of property names of the provided object and in your case it will return [iconArraya,iconArrayb,iconArrayc]
if want to do it this way you'll have reference the object i.e for each value in the array you need to do this object[value]
by the way this is called bracket notation you can search it if you're unfamiliar it the same using a dot like object.value
here's how ===
QUESTION
ANSWER
Answered 2020-Dec-02 at 22:47Sometimes websites won't let you load images without proper a referrer.
Yes. Plenty of websites do not want to pay to store images and transfer them over the network so that freeloaders can display them on their websites without shouldering the cost.
In a similar question I have found this answer, that suggests doing something like this
That fails for two reasons.
- It is a forbidden header. Browsers are designed to prevent your JavaScript from lying about where requests are being triggered from.
- Most sites hosting images don't grant permission, via CORS, to third-parties to read them with JS. They are even more unlikely to if they do referer checking to stop freeloading!
If a website doesn't want you displaying images they host, you need to respect that.
Pay for your own image hosting instead.
Don't copy the images from the third-party to your own site unless you are sure they aren't protected by copyright (or you have permission).
QUESTION
I have been trying to migrate an userScript into my own extension but for some reason I am not able to run the following code:
...ANSWER
Answered 2020-Aug-01 at 10:29To start with, remove the glob as it can cause issues.
QUESTION
How to add a function to judge that the mouse does not over the icon bar that it disappears automatically
In Tampermonkey, I use a JavaScript that I found in Greasyfork, it will popup when I select words on the website.
I want to achieve this when I move the mouse over the icon bar, it will not disappear, if I do not do that or move out the mouse, the icon bar will disappear automatically.
I used the mouseIn, mouseOver function, they did not work, please help me.
It is the total code in Greasyfork:
The browser search tool
The function to judge that the mouse does not over the icon bar:
...ANSWER
Answered 2020-May-07 at 05:37It is done.
Add two functions:
QUESTION
How this popup window will close automaticly after clicking on the icon and when scrolling and after 6 seconds?
...ANSWER
Answered 2020-May-07 at 05:31Use a timeout function, and it will close automatically.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install greasyfork
On a UNIX-like operating system, using your system’s package manager is easiest. However, the packaged Ruby version may not be the newest one. There is also an installer for Windows. Managers help you to switch between multiple Ruby versions on your system. Installers can be used to install a specific or multiple Ruby versions. Please refer ruby-lang.org for more information.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page