This repository has been archived by the owner on May 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
add a Team receiving widget #138
Merged
Merged
Changes from 16 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
6ff5189
Make clean copy of v1
mattbk 156eec4
Separate v1 and v2 tests
mattbk 53522a5
Assign tests to correct version
mattbk c23f9f3
Rename and fix paths for v1 tests
mattbk ba6c334
Rename v2 tests to identify
mattbk d1f4861
Remove anonymous receiving.
mattbk 4708074
Change all "receiv*" to "tak*".
mattbk acbadb0
Add basic team receiving functionality.
mattbk 1278ec8
Fix test for team widget.
mattbk 2e030f7
Remove legacy widgets.
mattbk a685ae9
Update test/example widgets.
mattbk 23ec53d
Remove anonymous giving and extra tests and fix tests.
mattbk 09ea5a2
Remove extra widgets.
mattbk 9b03787
Remove giving.
mattbk cc11356
Fix missed "taking" reference.
mattbk a3800e9
Merge branch 'master' into widgets-v2
mattbk 361df4c
Prune Gittip from api/v2
chadwhitacre 45575c9
Update Blogger widget for v2
chadwhitacre cc4657e
Remove goal from v2 API
chadwhitacre dbfde48
Remove identity from v2 api
chadwhitacre 72b886d
Update nomenclature in tests
chadwhitacre b71ac87
Update README for v2
chadwhitacre ba6c753
Update grtpAPI
chadwhitacre File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/** | ||
* Gratipay widget main initialization. | ||
* | ||
* Initializes widgets and pulls in the Widgets API if it isn't already loaded | ||
*/ | ||
(function() { | ||
'use strict'; | ||
|
||
// Short wrapper around document.querySelectorAll() | ||
function $(selector) { | ||
return document.querySelectorAll(selector); | ||
} | ||
|
||
// Slurp up widgets (identified by having the `data-gratipay-username` property) | ||
var elements = $('[data-gratipay-teamslug]'); | ||
|
||
// Cache length | ||
var length = elements.length; | ||
|
||
// Grab window.Gratipay if available | ||
var Gratipay = window.Gratipay || {}; | ||
|
||
// Where's our files? | ||
var api = window.grtpAPI || 'https://grtp.co/v1/'; | ||
|
||
window._grtp = window._grtp || []; | ||
|
||
// Load widget API if it hasn't been | ||
if (!Gratipay.widgets && !$('script[src="' + api + 'api.js"]').length) { | ||
var grtp = document.createElement('script'); | ||
grtp.src = api + 'api.js'; | ||
$('head')[0].appendChild(grtp); | ||
} | ||
|
||
// Load widgets | ||
for (var i=0; i<length; i++) { | ||
var element = elements[i]; | ||
|
||
// Ignore widgets with the `data-gratipay-readystatus` property | ||
if (!element.getAttribute('data-gratipay-readystatus')) { | ||
if (Gratipay.widgets) { | ||
Gratipay.widgets.load(element); | ||
} else { | ||
_grtp.push(element); | ||
} | ||
|
||
element.setAttribute('data-gratipay-readystatus', 'loading'); | ||
} | ||
} | ||
})(); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be v2.