reddit-wallpapers (beta)
Script to help in fetching wallpapers from Reddit API and loop setting them.
Install:
NPM: to bundle it however you like:
- To install it:
npm i reddit-wallpapers --save
- To import it:
const RedditWallpapers = require('reddit-wallpapers').default
import RedditWallpapers from 'reddit-wallpapers'
Browser:
- You can get the latest bundle from here
- Example:
<head>
<script src="https://mrf345.github.io/reddit-wallpapers/dist/RedditWallpapers.min.js"></script>
<script type='text/javascript'>
var options = {id: '.toChange'}
var WManager = RedditWallpapers(options)
</script>
</head>
<body>
<div class='.toChange'>
<h1>Reddit Wallpapers !</h1>
</div>
</body>
Options:
self.options = {
id: options.id || '.reddit',
category: options.category || self.categories,
duration: options.duration || 10000,
aDuration: options.aDuration * 1000 || 1000,
limit: options.limit || 30,
timeout: options.timeout * 1000 || 5000,
overlay: options.overlay || 'rgba(0,0,0,0.7)',
isOverlayed: options.isOverlayed || 'true',
isFixed: options.isFixed || 'false',
isMixed: options.isMixed || 'false',
isAnimated: options.isAnimated || 'true'
}
Support:
Should work with anything newer than Internet Explorer 10
and NodeJS 10
.
Interface:
Function | Describtion |
---|
WManager.next() | set the next wallpaper |
WManager.previous() | set the previous wallpaper |
WManager.stop() | stop loop setting wallpapers |
WManager.restart() | reset settings to default and restart intervals |