Giter VIP home page Giter VIP logo

wtfme.me's Introduction

wtfme.me logo
An open source collection of random memes and useless pages
Netlify Status

⚠️ This project is no longer mantained. 

You still can access the archived URL here: wtfmeme.mlomb.me. Former wtfme.me.

Contributing

wtfme.me is a community project. We invite you to add your random meme ideas. Even if you don't know how to code, you can throw ideas in the issues page.

Memes

Note: terms meme and (meme) page are used interchangeably

Each meme must be defined in src/pages.js including all the relevant metadata like so:

module.exports = [
  ...
  {
    title: 'Meme',
    description: 'A wonderful meme',
    keywords: ['keyword1', 'keyword2'],
    path: 'meme',
    module: 'meme.js',
    cover: {
        image: '<url>',
        hidden: false,
        spaced: false,
        customizable: false
    }
  },
  ...
]

Memes are located under src/pages. The name of the file must match the module variable in src/pages.js. The module must export an array called Variants. Each item must be a Preset object or an array of Preset objects.
For example:

import { ImgurPreset, GiphyPreset } from '@presets/ImagePreset';
import TextRainPreset from '@presets/TextRainPreset';

export let Variants = [
  new GiphyPreset('XXXXXXXXXXXXX'),
  [new ImgurPreset('XXXXXXX'), new TextRainPreset('Example meme')]
];

Variants

A single meme page may have multiple versions to show. For example, meme windows changes the error dialog every time someone refreshes the page.
Extracted from src/pages/windows.js:

...

class WindowsError extends CanvasPreset {
  constructor(url){
    ...
  }
}

export let Variants = [
  new WindowsError('i.imgur.com/jccR2lH.jpg'), // delete Windows
  new WindowsError('i.imgur.com/GUfDHmu.jpg'), // error recording error code
  new WindowsError('i.imgur.com/UyIeVFW.png'), // linux
  new WindowsError('i.imgur.com/kwVhVDZ.png'), // windows error recording has stopped working
  ...
];

Variants are randomly selected excluding the just seen to increase the chance of seeing them all while refreshing fast.

Presets

A preset or combination of them form a variant, they reside in src/presets and can be included using the alias @presets. All presets must inherit from Preset.
Every preset should be generic, reusable and single purpose.

Template for a Preset:

import Preset from './Preset';

export default class MyPreset extends Preset {
  constructor(text) {
    super();
    this.text = text;
  }

  init(root) {
    var p = document.createElement('p');
    p.innerText = `Hello meme, ${this.text}!`;
    root.appendChild(p);
  }

  frame(deltaTime) {
    // This function will be called each requestAnimationFrame
  }
}

For example, this is ImagePreset which allows show a fullscreen image just with an URL:

import Preset from './Preset';

export default class ImagePreset extends Preset {
  constructor(url) {
    super();
    this.url = url;
  }

  init(root) {
    var img = document.createElement('div');
    img.classList.add("fullscreen-contain");
    img.style.backgroundImage = 'url(' + this.url + ')';
    root.appendChild(img);
  }
}

Stacking presets

See the first meme example. A variant may be an array of simple presets.

For example, if you want to show a fullscreen GIF with a sound you could combine a ImagePreset with a SoundCloudPreset.

More advanced / Specific presets

You can always define or inherit a preset inside the meme module to create custom behavior. You can find an example of this in src/pages/windows.js where it defines the WindowsError preset that inherits the CanvasPreset.

Presets API

You can find the API documentation in API.md.

Customizable memes

Some pages can be dynamic, for example rain allows to change the raining text. You can see the implementation in src/pages/rain.js.
It should be an explanation on how to customize the meme in the base path (/rain in this case).
Make sure to update netlify.toml with the corresponding redirect.

Be careful with XSS attacks.

Styling guidelines

The code must use tabs. Documentation must use 2-spaces.

Building

To build for deployment run

npm run build

Once building, the script will pick up all the memes defined in src/pages.js and generate all the static HTML files in the dist directory.

Development

To start a development server run

npm run dev

You will be able to access the site in localhost:8080. Note that you should access the pages using .html, for example localhost:8080/nope.html. The dev server should have hot reloading enabled.

Note: if you modify pages.js you have to restart the dev server to pick up the changes

License

MIT License, see LICENSE.

wtfme.me's People

Contributors

mlomb avatar nmusacchio avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.