forked from gdeglin/fbjs-extensions
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME
57 lines (39 loc) · 1.76 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
This is an FB Javascript library designed to extend the available methods available to Facebook canvas page applications. It is loosely based on the Prototype javascript library.
This FBJS library has now been included in the Facebooker Ruby on Rails plugin. If you're using Facebooker then you already have this library (inside facebooker.js).
Usage examples (View source to see more):
Select Element
$('noelement');
Select 2 Elements
$('test1','test2');
Select elements by name
getElementsByClass('ename')
Select elements by class
getElementsByClass('test2c')
Select elements by tag
getElementsByTagName('strike')
Check if an element is visible
$('test1').visible()
Hide an element
$('test1').hide()
Show an element
$('test1').show()
Toggle element visibility
$('test1').toggle();
Remove an element from the dom
$('test1').remove();
Get a hash of calculated element dimensions width/height as integers
$('test1').getDimensions()
Update remote
Update: function(target_element, response_type, action_path, callbacks, post_parameters)
(FBML/RAW)
Ajax.Update('test1', 'FBML', 'http://...',{ success: function(){} })
Load Remote
Load: function(response_type, action_path, callbacks, post_parameters)
(FBML/RAW/JSON)
Ajax.Load('JSON','http://...',{ success: function(result){console.log(result)} }, {'json':test_content})
Pop up a confirmation Facebook dialog. Executes 'callback' if the user confirms.
confirm("Confirm action?", "Do you really want to do this?", function() { doIt(); })
Use Javascript version of .map
['a2','b2'].toSource() == map(['a','b'], function(val) { return val+2 }).toSource()
Recurse through the dom under a selected element and return nodes for which test is true as an array
collect($('test1'), function(element){ return (element.getClassName() == 'test2c') })