GithubHelp home page GithubHelp logo

humancopy / peace.js Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 1.0 35 KB

Spread peace

Home Page: https://peace.humancopy.net/

License: MIT License

CSS 25.19% JavaScript 49.53% SCSS 25.28%
peace love

peace.js's Introduction

PEACE.JS

Add the following piece (no pun intended) of code before the closing </body> tag on your website to promote PEACE.JS:

<script src="https://cdn.jsdelivr.net/npm/[email protected]/peace.min.js" async></script>

You can actually paste it anywhere inside the <body>. It will inject itself at the same DOM level as the <script> tag.

Target

By default, PEACE.JS will be appeneded to the parent element of the <script> tag. If you'd like to inject it somewhere else, simply add the data-target attribute:

<script src="https://cdn.jsdelivr.net/npm/[email protected]/peace.min.js" data-target="#footer" async></script>

Link

PEACE.JS will automatically link the generated peace banner to the project's homepage. By default the link will open in a new window. You can either change it to open in the same window or to not have any link at all (why would you want to do that though is beyond me ๐Ÿ˜). Possible values are: anything supported by the a[target] attribute or false to disable the link.

<script src="https://cdn.jsdelivr.net/npm/[email protected]/peace.min.js" data-link="_self" async></script>

Themes

The default text color for PEACE.JS is black. This can be controlled via the data-theme attribute. Possible values are: black, white, green, blue & red.

<script src="https://cdn.jsdelivr.net/npm/[email protected]/peace.min.js" data-theme="blue" async></script>

Style

By default, PEACE.JS will show the word Peace in different languages. If you prefer instead to show a peace symbol, simply add the data-style="symbol" attribute to the script tag. Possible values are: text, symbol

<script src="https://cdn.jsdelivr.net/npm/[email protected]/peace.min.js" data-style="symbol" async></script>

Autoloading

You can also disable the automatic activation of the banner by adding the attribute data-auto="false" to the script. You can then activate it by calling the peaceJS() function.

The peaceJS() function accepts an optional argument of either a hash of options, DOM element, DOM selector or jQuery object. Any option passed to peaceJS() has precedence over what was defined on the <script> tag.

<script src="https://cdn.jsdelivr.net/npm/[email protected]/peace.min.js" data-auto="false" data-theme="green" data-link="_self" async></script>

<script>
// Default behaviour
peaceJS();

// Append to #footer in green theme
peaceJS('#footer');

// Same as above but a jQuery object
peaceJS($('#footer'));

// Will append to #header, with a blue theme (precedence over green), symbol style
// and won't link back to the project :(
peaceJS({
  target: '#header',
   theme: 'blue',
   style: 'symbol',
    link: false
});
</script>

Share peace

Using PEACE.JS? Make a pull request to be listed here.

peace.js's People

Contributors

humancopy avatar lukasdrgon avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

lukasdrgon

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.