Code Monkey home page Code Monkey logo

open-donation-widget's Introduction

open-donation-widget is a simple HTML/Javascript widget that allows you to easily show where the money being donated is going. It leaves styling to the end-user (but there are plans to add some default styles for popular frontend frameworks). There are also plans to add support for popular backend frameworks, to make it easily integratable.

Installing

open-donation-widget is meant to be used in the browser. The easiest way to do so, is to grab a build in the build/ folder, and reference it from your website:

<script src="open-donation-widget-0.0.0.js"></script>

This will allow all following scripts to access OpenDonationForm. This object is instantiated with two DOM elements: the input field, and the are in which to output. The third argument is an options-object. The options are as follows:

  • moneyHandlers: An array of objects with name, percentage (optional), and fee (optional). These describe someone who may take an amount of the money as it passes through the system.
var input = document.querySelectorAll("input[type=number]")[0];
var output = document.querySelectorAll("#output")[0];
var form = new OpenDonationForm(input, output, {
    moneyHandlers: [
        { name: "Payments Provider", percentage: 5, fee: 0.25 },
        { name: "Platform",          percentage: 2, fee: 0    },
        { name: "Creator"                                     }
    ]
});

The result is a nice little info-bit about where the money went.

screenshot of example

Dependencies

This library strives to have as few dependencies as possible, while still making integrations easy. It should be possible to rely on no other libraries, and this is the goal.

  • underscore

License

Copyright (c) 2014 Niels Roesen Abildgaard [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

open-donation-widget's People

Contributors

hypesystem avatar

Watchers

 avatar  avatar  avatar

open-donation-widget's Issues

Static donation amount

It should be possible to render the widget for a set amount (donation amount not interchangable).

Limited donation amount

It should be possible to set a limit to the donation amount.

Maybe expressed as "minimum amount awarded to X" where X is a MoneyHandler. Alternatively with several constraints possible, and the donation amount is only validated if all pass.

Theme examples

Make an interactive example where different themes can be picked from a dropdown.

Expose as jquery plugin

In addition to being exposed as plain javascript, it should also be usable as a jQuery plugin.

$(".input").makeOpenDonationWidget(".output", {
    moneyHandlers: [
        //...
    ]
});

Change the interface to let a function handle changes

Instead of automatically printing to a DomElement, let the user provide a function which handles this.

In addition, create some standard-functions (ie. the one we have now: print to a DomElement, one that draws bar-charts, perhaps?)

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.