Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan-Paul-Kleijn authored Sep 27, 2020
1 parent ba3c6e3 commit 807980c
Show file tree
Hide file tree
Showing 42 changed files with 8,192 additions and 0 deletions.
148 changes: 148 additions & 0 deletions assets/css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
/* Donations */
#donationForm, #donationForm fieldset, #donationEmailaddress, #donationAmount input[type="radio"], #donationForm input[type="submit"], #donationForm .square {
border-width: 0;
}
#donationForm, #donationEmailaddress, #donationForm .square-textinput {
box-sizing: border-box;
}
#donationForm {
max-width: 20rem;
padding: 1rem;
font-family: sans-serif;
font-size: 1rem;
background-color: #ccc;
border: 3px dashed #000;
}
#donationForm fieldset {
margin: 1rem 0 0 0;
padding: 0;
}
#donationForm label {
display: block;
padding-top: 10px;
}
#donationForm h2, #donationForm label, #donationForm p {
margin: .125rem;
padding: 0;
}
#donationEmailaddress {
width: calc(100% - .25rem);
margin: .125rem;
line-height: 2rem;
padding: 0 .5rem;
font-size: 1rem;
}
#donationSubmit {
margin: 1rem 0 0 0;
}
#donationAmount input[type="radio"] {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0px;
overflow: hidden;
clip: rect(0 0 0 0);
}
#donationForm input[type="radio"]:checked + .square {
color: #ffffff;
background-color: #333;
}
#donationForm .square {
width: calc(25% - .25rem);
height: 1rem;
margin: .125rem;
padding: 1.5rem 0;
text-align: center;
line-height: 1rem;
display: block;
float: left;
background-color: #fff;
background-image: none;
cursor: pointer;
border-radius: 2px;
white-space: nowrap;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
cursor: pointer;
overflow: hidden;
transition: box-shadow .3s ease-out 0s,background-color .3s ease-out 0s,color .3s ease-out 0s,opacity .3s ease-out 0s;
}
#donationForm .square:hover, #donationForm .square:focus {
background-color: #e6e6e6;
text-decoration: none;
}
#donationForm .square:active{
outline: 0;
background-image: none;
-webkit-box-shadow: inset 0 3px 5px rgba(0,0,0,.125);
box-shadow: inset 0 3px 5px rgba(0,0,0,.125);
}
#donationForm .square.custom span {
display: block;
margin: -1rem 0 0.5rem 0;
font-weight: 200;
font-size: .8rem;
line-height: .8rem;
}
#donationForm .square-textinput {
border: 1px solid #333;
display: block;
width: calc(100% - .5rem);
margin: .4rem .25rem;
line-height: 1.4rem;
padding: .2rem;
font-family: inherit;
}
#donationForm input[type="submit"] {
display: block;
width: calc(100% - .2rem);
margin: .1rem;
line-height: 4rem;
background-color: #333;
cursor: pointer;
color: #ffffff;
font-size: inherit;
font-weight: bold;
border-radius: 2px;
}
#donationForm input[type="submit"]:before {
display: block;
content: "";
clear: both;
}
#donationForm .payment-icons {
margin-top: .5rem;
text-align: center;
}
#donationForm .payment-icon {
width: 3.2rem;
margin: 0.2rem;
fill: #eee;
display: inline-block;
}
#donationForm .payment-icon:hover {
fill: #fff;
}
.shaker {
animation: shake .82s cubic-bezier(.36,.07,.19,.97) both;
transform: translate3d(0, 0, 0);
backface-visibility: hidden;
perspective: 1000px;
}
@keyframes shake {
10%, 90% {
transform: translate3d(-1px, 0, 0);
}
20%, 80% {
transform: translate3d(2px, 0, 0);
}
30%, 50%, 70% {
transform: translate3d(-4px, 0, 0);
}
40%, 60% {
transform: translate3d(4px, 0, 0);
}
}
126 changes: 126 additions & 0 deletions assets/js/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
var donate = {
getElementsByTagAndClassName:function(tagname,classname){
var elements = document.getElementsByTagName(tagname),
elementsN = elements.length,
selection = [];
for(var d=0;d<elementsN;d++) {
if(elements[d].className.indexOf(classname)!=-1) {
selection.push(elements[d]);
}
}
return selection;
},
previousElementSibling:function(elem){
do {
elem = elem.previousSibling;
} while ( elem && elem.nodeType !== 1 );
return elem;
},
nextElementSibling:function(elem){
do {
elem = elem.nextSibling;
} while ( elem && elem.nodeType !== 1 );
return elem;
},
addevent:function(obj,type,fn,capture){
if(obj) {
if (obj.attachEvent) {
obj['e'+type+fn] = fn;
obj[type+fn] = function(){obj['e'+type+fn](window.event);}
obj.attachEvent('on'+type, obj[type+fn]);
} else
obj.addEventListener(type, fn, false);
}
},
delevent:function(obj, type, fn, capture){
if (obj.detachEvent) {
obj.detachEvent('on'+type, obj[type+fn]);
obj[type+fn] = null;
} else
obj.removeEventListener(type, fn, false);
},
getFocus:function(e){
var focused;
if (!e) var e = window.event;
if (e.target) focused = e.target;
else if (e.srcElement) focused = e.srcElement;
if (focused.nodeType == 3) focused = focused.parentNode;
if (document.querySelector) {
return focused.id;
} else if (!focused || focused == document.documentElement) {
return focused;
}
},
donations: {
setDonationEvents:function() {
if(document.getElementById('donationForm')) {
var obj=donate.getElementsByTagAndClassName('label','square');
for(var x=0; x<obj.length; x++) {
radioId = obj[x].getAttribute('for');
radio = document.getElementById(radioId);
donate.addevent(radio,'click',function(event){donate.donations.clearInputGroup('donationAmount',event);},false);
if(radioId == "donationCustom") {
customInput = document.getElementById('donationAmountCustom');
submitButton = document.getElementById('donationSubmit');
donate.addevent(radio,'click',function(){customInput.focus();},false);
donate.addevent(customInput,'focus',function(event){donate.donations.clearInputGroup('donationAmount',event);},false);
donate.addevent(customInput,'click',function(event){donate.donations.clearInputGroup('donationAmount',event);},false);
donate.addevent(submitButton,'click',function(event){donate.donations.checkInput(event);},false);
}
}
}
},
checkInput:function(e) {
donate.donations.isEmpty('donationAmount',e);
donate.donations.isEmail('donationEmail',e);
},
isEmail:function(id,e) {
var email = document.getElementById('donationEmailaddress'),
fs = document.getElementById(id),
regex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
if(regex.test(email.value)) return true;
e.preventDefault();
fs.classList.toggle('shaker');
email.focus();
setTimeout(function(){fs.classList.toggle('shaker');}, 820);
},
clearInputGroup:function(fieldsetId,e) {
var fs = document.getElementById(fieldsetId),
inputElems = fs.getElementsByTagName('input'),
elem = donate.getFocus(e);
for(var i=0; i<inputElems.length; i++) {
if(inputElems[i].id != elem) {
if(inputElems[i].getAttribute('type')=='radio') {
if(donate.nextElementSibling(inputElems[i]).getElementsByTagName('input').length==0) inputElems[i].checked = false;
} else {
if(inputElems[i].getAttribute('type')=='number' || inputElems[i].getAttribute('type')=='text') {
if(donate.previousElementSibling(inputElems[i].parentNode).checked === false) inputElems[i].value = "";
}
}
} else {
if(inputElems[i].type==='radio') inputElems[i].checked = true;
else donate.previousElementSibling(inputElems[i].parentNode).checked = true;
}
}
},
isEmpty:function(fieldsetId,e) {
var fs = document.getElementById(fieldsetId),
inputElems = fs.getElementsByTagName('input'),
set;
for(var i=0; i<inputElems.length; i++) {
if(inputElems[i].getAttribute('type')!='submit') {
if(inputElems[i].getAttribute('type')=='radio') {
if(inputElems[i].checked == true && inputElems[i].value != 'x') return true;
}
if(inputElems[i].getAttribute('type')=='number' || inputElems[i].getAttribute('type')=='text') {
if(inputElems[i].value != "") return true;
}
}
}
e.preventDefault();
fs.classList.toggle('shaker');
setTimeout(function(){fs.classList.toggle('shaker');}, 820);
}
}
}
donate.addevent(window,"load",function(){donate.donations.setDonationEvents();},false);
68 changes: 68 additions & 0 deletions includes/Mollie/API/Autoloader.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?php
/**
* Copyright (c) 2013, Mollie B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* @license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php
* @author Mollie B.V. <[email protected]>
* @copyright Mollie B.V.
* @link https://www.mollie.com
*/
class Mollie_API_Autoloader
{
/**
* @param string $class_name
*/
public static function autoload ($class_name)
{
if (strpos($class_name, "Mollie_") === 0)
{
$file_name = str_replace("_", "/", $class_name);
$file_name = realpath(dirname(__FILE__) . "/../../{$file_name}.php");

if ($file_name !== false)
{
require $file_name;
}
}
}

/**
* @return bool
*/
public static function register ()
{
return spl_autoload_register(array(__CLASS__, "autoload"));
}

/**
* @return bool
*/
public static function unregister ()
{
return spl_autoload_unregister(array(__CLASS__, "autoload"));
}
}

Mollie_API_Autoloader::register();
Loading

0 comments on commit 807980c

Please sign in to comment.