Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
renderjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Ivan Tyagov
renderjs
Commits
e44f4e58
Commit
e44f4e58
authored
Nov 15, 2012
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minify even more.
parent
3a6b374c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
renderjs-0.1.min.js
renderjs-0.1.min.js
+1
-1
No files found.
renderjs-0.1.min.js
View file @
e44f4e58
"
use strict
"
;
var
RENDERJS_ENABLE_IMPLICIT_GADGET_RENDERING
=
true
;
var
RENDERJS_ENABLE_IMPLICIT_INTERACTION_BIND
=
true
;
if
(
typeof
console
===
"
undefined
"
||
typeof
console
.
log
===
"
undefined
"
){
console
=
{};
console
.
log
=
function
(){}}
var
RenderJs
=
(
function
(){
var
is_ready
=
false
;
return
{
init
:
function
(){
if
(
RENDERJS_ENABLE_IMPLICIT_GADGET_RENDERING
){
RenderJs
.
bootstrap
(
$
(
'
body
'
))}
if
(
RENDERJS_ENABLE_IMPLICIT_INTERACTION_BIND
){
var
root_gadget
=
RenderJs
.
GadgetIndex
.
getRootGadget
();
if
(
root_gadget
!==
undefined
){
RenderJs
.
bindReady
(
function
(){
$
(
"
div[data-gadget-connection]
"
).
each
(
function
(
index
,
element
){
RenderJs
.
InteractionGadget
.
bind
(
$
(
element
))})})}}},
bootstrap
:
function
(
root
){
var
gadget_id
,
is_gadget
;
gadget_id
=
root
.
attr
(
"
id
"
);
is_gadget
=
root
.
attr
(
"
data-gadget
"
)
!==
undefined
;
if
(
is_gadget
&&
gadget_id
!==
undefined
){
RenderJs
.
loadGadgetFromUrl
(
root
)}
RenderJs
.
load
(
root
)},
load
:
function
(
root
){
var
gadget_list
,
gadget
,
gadget_id
,
gadget_js
;
gadget_list
=
root
.
find
(
"
[data-gadget]
"
);
gadget_list
.
each
(
function
(){
gadget
=
$
(
this
);
gadget_id
=
gadget
.
attr
(
"
id
"
);
gadget_js
=
new
RenderJs
.
Gadget
(
gadget_id
,
gadget
);
RenderJs
.
GadgetIndex
.
registerGadget
(
gadget_js
)});
gadget_list
.
each
(
function
(){
RenderJs
.
loadGadgetFromUrl
(
$
(
this
))})},
updateAndRecurse
:
function
(
gadget
,
data
){
gadget
.
append
(
data
);
this
.
load
(
gadget
)},
loadGadgetFromUrl
:
function
(
gadget
){
var
url
,
gadget_id
,
gadget_property
,
cacheable
,
cache_id
,
app_cache
,
data
,
gadget_js
;
url
=
gadget
.
attr
(
"
data-gadget
"
);
gadget_id
=
gadget
.
attr
(
"
id
"
);
gadget_js
=
RenderJs
.
GadgetIndex
.
getGadgetById
(
gadget_id
);
if
(
gadget_js
===
undefined
){
gadget_js
=
new
RenderJs
.
Gadget
(
gadget_id
,
gadget
);
RenderJs
.
GadgetIndex
.
registerGadget
(
gadget_js
)}
gadget_property
=
gadget
.
attr
(
"
data-gadget-property
"
);
if
(
gadget_property
!==
undefined
){
gadget_property
=
$
.
parseJSON
(
gadget_property
);
$
.
each
(
gadget_property
,
function
(
key
,
value
){
gadget_js
[
key
]
=
value
})}
if
(
url
!==
undefined
&&
url
!==
""
){
cacheable
=
gadget
.
attr
(
"
data-gadget-cacheable
"
);
cache_id
=
gadget
.
attr
(
"
data-gadget-cache-id
"
);
if
(
cacheable
!==
undefined
&&
cache_id
!==
undefined
){
cacheable
=
Boolean
(
parseInt
(
cacheable
,
10
))}
if
(
cacheable
){
app_cache
=
RenderJs
.
Cache
.
get
(
cache_id
,
undefined
);
if
(
app_cache
===
undefined
||
app_cache
===
null
){
$
.
ajax
({
url
:
url
,
yourCustomData
:{
"
gadget_id
"
:
gadget_id
,
"
cache_id
"
:
cache_id
},
success
:
function
(
data
){
cache_id
=
this
.
yourCustomData
.
cache_id
;
gadget_id
=
this
.
yourCustomData
.
gadget_id
;
RenderJs
.
Cache
.
set
(
cache_id
,
data
);
RenderJs
.
GadgetIndex
.
getGadgetById
(
gadget_id
).
setReady
();
RenderJs
.
updateAndRecurse
(
gadget
,
data
);
RenderJs
.
checkAndTriggerReady
()}})}
else
{
data
=
app_cache
;
gadget_js
.
setReady
();
this
.
updateAndRecurse
(
gadget
,
data
);
this
.
checkAndTriggerReady
()}}
else
{
$
.
ajax
({
url
:
url
,
yourCustomData
:{
"
gadget_id
"
:
gadget_id
},
success
:
function
(
data
){
gadget_id
=
this
.
yourCustomData
.
gadget_id
;
RenderJs
.
GadgetIndex
.
getGadgetById
(
gadget_id
).
setReady
();
RenderJs
.
updateAndRecurse
(
gadget
,
data
);
RenderJs
.
checkAndTriggerReady
()}})}}
else
{
gadget_js
.
setReady
();
RenderJs
.
checkAndTriggerReady
()}},
isReady
:
function
(
value
){
return
is_ready
},
setReady
:
function
(
value
){
is_ready
=
value
},
bindReady
:
function
(
ready_function
){
$
(
"
body
"
).
one
(
"
ready
"
,
ready_function
)},
checkAndTriggerReady
:
function
(){
var
is_gadget_list_loaded
;
is_gadget_list_loaded
=
RenderJs
.
GadgetIndex
.
isGadgetListLoaded
();
if
(
is_gadget_list_loaded
){
if
(
!
RenderJs
.
isReady
()){
RenderJs
.
GadgetIndex
.
getRootGadget
().
getDom
().
trigger
(
"
ready
"
);
$
(
"
body
"
).
trigger
(
"
ready
"
);
RenderJs
.
setReady
(
true
)}}
return
is_gadget_list_loaded
},
update
:
function
(
root
){
root
.
find
(
"
[gadget]
"
).
each
(
function
(
i
,
v
){
RenderJs
.
updateGadgetData
(
$
(
this
))})},
updateGadgetWithDataHandler
:
function
(
result
){
var
data_handler
;
data_handler
=
this
.
yourCustomData
.
data_handler
;
if
(
data_handler
!==
undefined
){
eval
(
data_handler
+
"
(result)
"
)}},
updateGadgetData
:
function
(
gadget
){
var
data_source
,
data_handler
;
data_source
=
gadget
.
attr
(
"
data-gadget-source
"
);
data_handler
=
gadget
.
attr
(
"
data-gadget-handler
"
);
if
(
data_source
!==
undefined
&&
data_source
!==
""
){
$
.
ajax
({
url
:
data_source
,
dataType
:
"
json
"
,
yourCustomData
:{
"
data_handler
"
:
data_handler
},
success
:
RenderJs
.
updateGadgetWithDataHandler
})}},
addGadget
:
function
(
dom_id
,
gadget
,
gadget_data_handler
,
gadget_data_source
){
var
html_string
,
tab_container
,
tab_gadget
;
tab_container
=
$
(
'
#
'
+
dom_id
);
tab_container
.
empty
();
html_string
=
[
'
<div class="gadget"
'
,
'
data-gadget="
'
+
gadget
+
'
"
'
,
'
data-gadget-handler="
'
+
gadget_data_handler
+
'
"
'
,
'
data-gadget-source="
'
+
gadget_data_source
+
'
"></div>
'
].
join
(
'
\n
'
);
tab_container
.
append
(
html_string
);
tab_gadget
=
tab_container
.
find
(
"
.gadget
"
);
RenderJs
.
bootstrap
(
tab_container
);
RenderJs
.
setReady
(
false
);
return
tab_gadget
},
Cache
:(
function
(){
return
{
ROOT_CACHE_ID
:
'
APP_CACHE
'
,
getCacheId
:
function
(
cache_id
){
return
this
.
ROOT_CACHE_ID
+
cache_id
},
hasLocalStorage
:
function
(){
var
mod
;
mod
=
'
localstorage_test_12345678
'
;
try
{
localStorage
.
setItem
(
mod
,
mod
);
localStorage
.
removeItem
(
mod
);
return
true
}
catch
(
e
){
return
false
}},
get
:
function
(
cache_id
,
default_value
){
cache_id
=
this
.
getCacheId
(
cache_id
);
if
(
this
.
hasLocalStorage
()){
return
this
.
LocalStorageCachePlugin
.
get
(
cache_id
,
default_value
)}
return
this
.
NameSpaceStorageCachePlugin
.
get
(
cache_id
,
default_value
)},
set
:
function
(
cache_id
,
data
){
cache_id
=
this
.
getCacheId
(
cache_id
);
if
(
this
.
hasLocalStorage
()){
this
.
LocalStorageCachePlugin
.
set
(
cache_id
,
data
)}
else
{
this
.
NameSpaceStorageCachePlugin
.
set
(
cache_id
,
data
)}},
LocalStorageCachePlugin
:(
function
(){
return
{
get
:
function
(
cache_id
,
default_value
){
if
(
cache_id
in
localStorage
){
return
JSON
.
parse
(
localStorage
.
getItem
(
cache_id
))}
else
{
return
default_value
}},
set
:
function
(
cache_id
,
data
){
localStorage
.
setItem
(
cache_id
,
JSON
.
stringify
(
data
))}}}()),
NameSpaceStorageCachePlugin
:(
function
(){
var
namespace
=
{};
return
{
get
:
function
(
cache_id
,
default_value
){
return
namespace
[
cache_id
]},
set
:
function
(
cache_id
,
data
){
namespace
[
cache_id
]
=
data
}}}())}}()),
Gadget
:(
function
(
gadget_id
,
dom
){
this
.
id
=
gadget_id
;
this
.
dom
=
dom
;
this
.
is_ready
=
false
;
this
.
getId
=
function
(){
return
this
.
id
};
this
.
getDom
=
function
(){
return
this
.
dom
};
this
.
isReady
=
function
(){
return
this
.
is_ready
};
this
.
setReady
=
function
(){
this
.
is_ready
=
true
}}),
TabbularGadget
:(
function
(){
return
{
toggleVisibility
:
function
(
visible_dom
){
$
(
"
.selected
"
).
addClass
(
"
not_selected
"
);
$
(
"
.selected
"
).
removeClass
(
"
selected
"
);
visible_dom
.
addClass
(
"
selected
"
);
visible_dom
.
removeClass
(
"
not_selected
"
)},
addNewTabGadget
:
function
(
dom_id
,
gadget
,
gadget_data_handler
,
gadget_data_source
){
var
tab_gadget
;
tab_gadget
=
RenderJs
.
addGadget
(
dom_id
,
gadget
,
gadget_data_handler
,
gadget_data_source
)}}}()),
GadgetIndex
:(
function
(){
var
gadget_list
=
[];
return
{
getGadgetList
:
function
(){
return
gadget_list
},
registerGadget
:
function
(
gadget
){
gadget_list
.
push
(
gadget
)},
unregisterGadget
:
function
(
gadget
){
var
index
=
$
.
inArray
(
gadget
,
gadget_list
);
if
(
index
!==-
1
){
gadget_list
.
splice
(
index
,
1
)}},
getGadgetById
:
function
(
gadget_id
){
var
gadget
;
gadget
=
undefined
;
$
(
RenderJs
.
GadgetIndex
.
getGadgetList
()).
each
(
function
(
index
,
value
){
if
(
value
.
getId
()
===
gadget_id
){
gadget
=
value
}});
return
gadget
},
getRootGadget
:
function
(){
return
this
.
getGadgetList
()[
0
]},
isGadgetListLoaded
:
function
(){
var
result
;
result
=
true
;
$
(
this
.
getGadgetList
()).
each
(
function
(
index
,
value
){
if
(
value
.
isReady
()
===
false
){
result
=
false
}});
return
result
}}}()),
InteractionGadget
:(
function
(){
return
{
bind
:
function
(
gadget_dom
){
var
gadget_id
,
gadget_connection_list
,
createMethodInteraction
=
function
(
original_source_method_id
,
source_gadget_id
,
source_method_id
,
destination_gadget_id
,
destination_method_id
){
var
interaction
=
function
(){
RenderJs
.
GadgetIndex
.
getGadgetById
(
source_gadget_id
)[
original_source_method_id
].
apply
(
null
,
arguments
);
RenderJs
.
GadgetIndex
.
getGadgetById
(
destination_gadget_id
).
dom
.
trigger
(
source_method_id
)};
return
interaction
},
createTriggerInteraction
=
function
(
destination_gadget_id
,
destination_method_id
){
var
interaction
=
function
(){
RenderJs
.
GadgetIndex
.
getGadgetById
(
destination_gadget_id
)[
destination_method_id
].
apply
(
null
,
arguments
)};
return
interaction
};
gadget_id
=
gadget_dom
.
attr
(
"
id
"
);
gadget_connection_list
=
gadget_dom
.
attr
(
"
data-gadget-connection
"
);
gadget_connection_list
=
$
.
parseJSON
(
gadget_connection_list
);
$
.
each
(
gadget_connection_list
,
function
(
key
,
value
){
var
source
,
source_gadget_id
,
source_method_id
,
source_gadget
,
destination
,
destination_gadget_id
,
destination_method_id
,
destination_gadget
,
original_source_method_id
;
source
=
value
.
source
.
split
(
"
.
"
);
source_gadget_id
=
source
[
0
];
source_method_id
=
source
[
1
];
source_gadget
=
RenderJs
.
GadgetIndex
.
getGadgetById
(
source_gadget_id
);
destination
=
value
.
destination
.
split
(
"
.
"
);
destination_gadget_id
=
destination
[
0
];
destination_method_id
=
destination
[
1
];
destination_gadget
=
RenderJs
.
GadgetIndex
.
getGadgetById
(
destination_gadget_id
);
if
(
source_gadget
.
hasOwnProperty
(
source_method_id
)){
original_source_method_id
=
"
original_
"
+
source_method_id
;
source_gadget
[
original_source_method_id
]
=
source_gadget
[
source_method_id
];
source_gadget
[
source_method_id
]
=
createMethodInteraction
(
original_source_method_id
,
source_gadget_id
,
source_method_id
,
destination_gadget_id
,
destination_method_id
);
destination_gadget
.
dom
.
bind
(
source_method_id
,
createTriggerInteraction
(
destination_gadget_id
,
destination_method_id
))}
else
{
source_gadget
.
dom
.
bind
(
source_method_id
,
createTriggerInteraction
(
destination_gadget_id
,
destination_method_id
))}})}}}())}}());
$
(
document
).
ready
(
function
(){
RenderJs
.
init
()});
\ No newline at end of file
"
use strict
"
;
var
RENDERJS_ENABLE_IMPLICIT_GADGET_RENDERING
=
true
;
var
RENDERJS_ENABLE_IMPLICIT_INTERACTION_BIND
=
true
;
if
(
typeof
console
===
"
undefined
"
||
typeof
console
.
log
===
"
undefined
"
){
console
=
{};
console
.
log
=
function
(){}}
var
RenderJs
=
(
function
(){
var
i
=
false
;
return
{
init
:
function
(){
if
(
RENDERJS_ENABLE_IMPLICIT_GADGET_RENDERING
){
RenderJs
.
bootstrap
(
$
(
'
body
'
))}
if
(
RENDERJS_ENABLE_IMPLICIT_INTERACTION_BIND
){
var
c
=
RenderJs
.
GadgetIndex
.
getRootGadget
();
if
(
c
!==
undefined
){
RenderJs
.
bindReady
(
function
(){
$
(
"
div[data-gadget-connection]
"
).
each
(
function
(
a
,
b
){
RenderJs
.
InteractionGadget
.
bind
(
$
(
b
))})})}}},
bootstrap
:
function
(
a
){
var
b
,
is_gadget
;
b
=
a
.
attr
(
"
id
"
);
is_gadget
=
a
.
attr
(
"
data-gadget
"
)
!==
undefined
;
if
(
is_gadget
&&
b
!==
undefined
){
RenderJs
.
loadGadget
(
a
)}
RenderJs
.
loadRecursiveGadget
(
a
)},
loadRecursiveGadget
:
function
(
a
){
var
b
,
gadget
,
gadget_id
,
gadget_js
;
b
=
a
.
find
(
"
[data-gadget]
"
);
b
.
each
(
function
(){
gadget
=
$
(
this
);
gadget_id
=
gadget
.
attr
(
"
id
"
);
gadget_js
=
new
RenderJs
.
Gadget
(
gadget_id
,
gadget
);
RenderJs
.
GadgetIndex
.
registerGadget
(
gadget_js
)});
b
.
each
(
function
(){
RenderJs
.
loadGadget
(
$
(
this
))})},
setGadgetAndRecurse
:
function
(
a
,
b
){
a
.
append
(
b
);
RenderJs
.
loadRecursiveGadget
(
a
)},
loadGadget
:
function
(
c
){
var
d
,
gadget_id
,
gadget_property
,
cacheable
,
cache_id
,
app_cache
,
data
,
gadget_js
;
d
=
c
.
attr
(
"
data-gadget
"
);
gadget_id
=
c
.
attr
(
"
id
"
);
gadget_js
=
RenderJs
.
GadgetIndex
.
getGadgetById
(
gadget_id
);
if
(
gadget_js
===
undefined
){
gadget_js
=
new
RenderJs
.
Gadget
(
gadget_id
,
c
);
RenderJs
.
GadgetIndex
.
registerGadget
(
gadget_js
)}
gadget_property
=
c
.
attr
(
"
data-gadget-property
"
);
if
(
gadget_property
!==
undefined
){
gadget_property
=
$
.
parseJSON
(
gadget_property
);
$
.
each
(
gadget_property
,
function
(
a
,
b
){
gadget_js
[
a
]
=
b
})}
if
(
d
!==
undefined
&&
d
!==
""
){
cacheable
=
c
.
attr
(
"
data-gadget-cacheable
"
);
cache_id
=
c
.
attr
(
"
data-gadget-cache-id
"
);
if
(
cacheable
!==
undefined
&&
cache_id
!==
undefined
){
cacheable
=
Boolean
(
parseInt
(
cacheable
,
10
))}
if
(
cacheable
){
app_cache
=
RenderJs
.
Cache
.
get
(
cache_id
,
undefined
);
if
(
app_cache
===
undefined
||
app_cache
===
null
){
$
.
ajax
({
url
:
d
,
yourCustomData
:{
"
gadget_id
"
:
gadget_id
,
"
cache_id
"
:
cache_id
},
success
:
function
(
a
){
cache_id
=
this
.
yourCustomData
.
cache_id
;
gadget_id
=
this
.
yourCustomData
.
gadget_id
;
RenderJs
.
Cache
.
set
(
cache_id
,
a
);
RenderJs
.
GadgetIndex
.
getGadgetById
(
gadget_id
).
setReady
();
RenderJs
.
setGadgetAndRecurse
(
c
,
a
);
RenderJs
.
checkAndTriggerReady
()}})}
else
{
data
=
app_cache
;
gadget_js
.
setReady
();
this
.
setGadgetAndRecurse
(
c
,
data
);
this
.
checkAndTriggerReady
()}}
else
{
$
.
ajax
({
url
:
d
,
yourCustomData
:{
"
gadget_id
"
:
gadget_id
},
success
:
function
(
a
){
gadget_id
=
this
.
yourCustomData
.
gadget_id
;
RenderJs
.
GadgetIndex
.
getGadgetById
(
gadget_id
).
setReady
();
RenderJs
.
setGadgetAndRecurse
(
c
,
a
);
RenderJs
.
checkAndTriggerReady
()}})}}
else
{
gadget_js
.
setReady
();
RenderJs
.
checkAndTriggerReady
()}},
isReady
:
function
(
a
){
return
i
},
setReady
:
function
(
a
){
i
=
a
},
bindReady
:
function
(
a
){
$
(
"
body
"
).
one
(
"
ready
"
,
a
)},
checkAndTriggerReady
:
function
(){
var
a
;
a
=
RenderJs
.
GadgetIndex
.
isGadgetListLoaded
();
if
(
a
){
if
(
!
RenderJs
.
isReady
()){
RenderJs
.
GadgetIndex
.
getRootGadget
().
getDom
().
trigger
(
"
ready
"
);
$
(
"
body
"
).
trigger
(
"
ready
"
);
RenderJs
.
setReady
(
true
)}}
return
a
},
updateGadgetData
:
function
(
c
){
var
d
,
data_handler
;
d
=
c
.
attr
(
"
data-gadget-source
"
);
data_handler
=
c
.
attr
(
"
data-gadget-handler
"
);
if
(
d
!==
undefined
&&
d
!==
""
){
$
.
ajax
({
url
:
d
,
dataType
:
"
json
"
,
yourCustomData
:{
"
data_handler
"
:
data_handler
},
success
:
function
(
a
){
var
b
;
b
=
this
.
yourCustomData
.
data_handler
;
if
(
b
!==
undefined
){
eval
(
b
+
"
(result)
"
)}}})}},
addGadget
:
function
(
a
,
b
,
c
,
d
){
var
e
,
tab_container
,
tab_gadget
;
tab_container
=
$
(
'
#
'
+
a
);
tab_container
.
empty
();
e
=
[
'
<div class="gadget"
'
,
'
data-gadget="
'
+
b
+
'
"
'
,
'
data-gadget-handler="
'
+
c
+
'
"
'
,
'
data-gadget-source="
'
+
d
+
'
"></div>
'
].
join
(
'
\n
'
);
tab_container
.
append
(
e
);
tab_gadget
=
tab_container
.
find
(
"
.gadget
"
);
RenderJs
.
bootstrap
(
tab_container
);
RenderJs
.
setReady
(
false
);
return
tab_gadget
},
Cache
:(
function
(){
return
{
ROOT_CACHE_ID
:
'
APP_CACHE
'
,
getCacheId
:
function
(
a
){
return
this
.
ROOT_CACHE_ID
+
a
},
hasLocalStorage
:
function
(){
var
a
;
a
=
'
localstorage_test_12345678
'
;
try
{
localStorage
.
setItem
(
a
,
a
);
localStorage
.
removeItem
(
a
);
return
true
}
catch
(
e
){
return
false
}},
get
:
function
(
a
,
b
){
a
=
this
.
getCacheId
(
a
);
if
(
this
.
hasLocalStorage
()){
return
this
.
LocalStorageCachePlugin
.
get
(
a
,
b
)}
return
this
.
NameSpaceStorageCachePlugin
.
get
(
a
,
b
)},
set
:
function
(
a
,
b
){
a
=
this
.
getCacheId
(
a
);
if
(
this
.
hasLocalStorage
()){
this
.
LocalStorageCachePlugin
.
set
(
a
,
b
)}
else
{
this
.
NameSpaceStorageCachePlugin
.
set
(
a
,
b
)}},
LocalStorageCachePlugin
:(
function
(){
return
{
get
:
function
(
a
,
b
){
if
(
a
in
localStorage
){
return
JSON
.
parse
(
localStorage
.
getItem
(
a
))}
else
{
return
b
}},
set
:
function
(
a
,
b
){
localStorage
.
setItem
(
a
,
JSON
.
stringify
(
b
))}}}()),
NameSpaceStorageCachePlugin
:(
function
(){
var
c
=
{};
return
{
get
:
function
(
a
,
b
){
return
c
[
a
]},
set
:
function
(
a
,
b
){
c
[
a
]
=
b
}}}())}}()),
Gadget
:(
function
(
a
,
b
){
this
.
id
=
a
;
this
.
dom
=
b
;
this
.
is_ready
=
false
;
this
.
getId
=
function
(){
return
this
.
id
};
this
.
getDom
=
function
(){
return
this
.
dom
};
this
.
isReady
=
function
(){
return
this
.
is_ready
};
this
.
setReady
=
function
(){
this
.
is_ready
=
true
}}),
TabbularGadget
:(
function
(){
return
{
toggleVisibility
:
function
(
a
){
$
(
"
.selected
"
).
addClass
(
"
not_selected
"
);
$
(
"
.selected
"
).
removeClass
(
"
selected
"
);
a
.
addClass
(
"
selected
"
);
a
.
removeClass
(
"
not_selected
"
)},
addNewTabGadget
:
function
(
a
,
b
,
c
,
d
){
var
e
;
e
=
RenderJs
.
addGadget
(
a
,
b
,
c
,
d
)}}}()),
GadgetIndex
:(
function
(){
var
e
=
[];
return
{
getGadgetList
:
function
(){
return
e
},
registerGadget
:
function
(
a
){
e
.
push
(
a
)},
unregisterGadget
:
function
(
a
){
var
b
=
$
.
inArray
(
a
,
e
);
if
(
b
!==-
1
){
e
.
splice
(
b
,
1
)}},
getGadgetById
:
function
(
c
){
var
d
;
d
=
undefined
;
$
(
RenderJs
.
GadgetIndex
.
getGadgetList
()).
each
(
function
(
a
,
b
){
if
(
b
.
getId
()
===
c
){
d
=
b
}});
return
d
},
getRootGadget
:
function
(){
return
this
.
getGadgetList
()[
0
]},
isGadgetListLoaded
:
function
(){
var
c
;
c
=
true
;
$
(
this
.
getGadgetList
()).
each
(
function
(
a
,
b
){
if
(
b
.
isReady
()
===
false
){
c
=
false
}});
return
c
}}}()),
InteractionGadget
:(
function
(){
return
{
bind
:
function
(
g
){
var
h
,
gadget_connection_list
,
createMethodInteraction
=
function
(
a
,
b
,
c
,
d
,
e
){
var
f
=
function
(){
RenderJs
.
GadgetIndex
.
getGadgetById
(
b
)[
a
].
apply
(
null
,
arguments
);
RenderJs
.
GadgetIndex
.
getGadgetById
(
d
).
dom
.
trigger
(
c
)};
return
f
},
createTriggerInteraction
=
function
(
a
,
b
){
var
c
=
function
(){
RenderJs
.
GadgetIndex
.
getGadgetById
(
a
)[
b
].
apply
(
null
,
arguments
)};
return
c
};
h
=
g
.
attr
(
"
id
"
);
gadget_connection_list
=
g
.
attr
(
"
data-gadget-connection
"
);
gadget_connection_list
=
$
.
parseJSON
(
gadget_connection_list
);
$
.
each
(
gadget_connection_list
,
function
(
a
,
b
){
var
c
,
source_gadget_id
,
source_method_id
,
source_gadget
,
destination
,
destination_gadget_id
,
destination_method_id
,
destination_gadget
,
original_source_method_id
;
c
=
b
.
source
.
split
(
"
.
"
);
source_gadget_id
=
c
[
0
];
source_method_id
=
c
[
1
];
source_gadget
=
RenderJs
.
GadgetIndex
.
getGadgetById
(
source_gadget_id
);
destination
=
b
.
destination
.
split
(
"
.
"
);
destination_gadget_id
=
destination
[
0
];
destination_method_id
=
destination
[
1
];
destination_gadget
=
RenderJs
.
GadgetIndex
.
getGadgetById
(
destination_gadget_id
);
if
(
source_gadget
.
hasOwnProperty
(
source_method_id
)){
original_source_method_id
=
"
original_
"
+
source_method_id
;
source_gadget
[
original_source_method_id
]
=
source_gadget
[
source_method_id
];
source_gadget
[
source_method_id
]
=
createMethodInteraction
(
original_source_method_id
,
source_gadget_id
,
source_method_id
,
destination_gadget_id
,
destination_method_id
);
destination_gadget
.
dom
.
bind
(
source_method_id
,
createTriggerInteraction
(
destination_gadget_id
,
destination_method_id
))}
else
{
source_gadget
.
dom
.
bind
(
source_method_id
,
createTriggerInteraction
(
destination_gadget_id
,
destination_method_id
))}})}}}())}}());
$
(
document
).
ready
(
function
(){
RenderJs
.
init
()});
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment