Commit 4f62489e authored by Sven Franck's avatar Sven Franck

refactor - autonomize

parent c9aeaf90
......@@ -14,7 +14,6 @@
@media all and (min-width: 60em) {
#about_info .about_element_wrapper {max-width: 70%;}
}
</style>
</head>
<body>
......
......@@ -24,43 +24,17 @@
<script type="text/javascript">
//<![CDATA[
(function () {
var gadget = RenderJs.getSelfGadget(),
recursive_gadgets = gadget.dom.find("[data-gadget]").not(".main-interactor"),
len = recursive_gadgets.length;
/* initialize translation */
var gadget = RenderJs.getSelfGadget();
recursive_gadgets.each(function (i) {
var passJSON = gadget[$(this).attr('id')],
string, new_string,
current_id = $(this).attr('id'),
new_id = current_id+"__"+gadget.dom.attr('id');
// pass on JSON if present BEFORE modifying gadget-id
if (passJSON !== undefined) {
$(this).attr('data-gadget-property','{"self":'+JSON.stringify(passJSON)+'}');
RenderJs.bindReady(function () {
// trigger create
if (gadget.isEnhanced() === undefined || gadget.isEnhanced() === false) {
gadget.dom.trigger("create");
}
// dynamic gadget-id
$(this).attr('id', new_id);
// update interactions
string = gadget.dom.find(".main-interactor").attr("data-gadget-connection");
new_string = string.replace(current_id,new_id);
gadget.dom.find(".main-interactor").attr("data-gadget-connection",new_string);
});
// modify gadget
if (gadget.self !== undefined) {
for (key in gadget.self) {
if (gadget.self.hasOwnProperty(key)) {
gadget.dom.find(key).attr(gadget.self[key][0],gadget.self[key][1]);
}
}
}
$(document).ready(function() {
// trigger enhancement
$(this).trigger("render_enhance", {gadget: gadget.dom});
});
$(document).ready(function() { });
})();
//]]>
</script>
......
......@@ -4,13 +4,9 @@
<head>
</head>
<body>
<div id="index_configure" data-gadget="../gadgets/configure.html"></div>
<div id="index_social" data-gadget="../gadgets/social.html"></div>
<div id="index_nav" data-gadget="../gadgets/navigation.html"></div>
<div id="configure" data-gadget="../gadgets/configure.html"></div>
<div id="social" data-gadget="../gadgets/social.html"></div>
<div id="nav" data-gadget="../gadgets/navigation.html"></div>
<p class="mini t" data-i18n="gen.disclaimer"></p>
<!-- interactions -->
<div data-gadget="" class="main-interactor"
data-gadget-connection="[]">
</body>
</html>
\ No newline at end of file
......@@ -13,8 +13,5 @@
<div id="legal_info" data-gadget="../gadgets/legal.html"></div>
<div id="legal_social" data-gadget="../gadgets/social.html"></div>
<div id="legal_nav" data-gadget="../gadgets/navigation.html"></div>
<!-- interactions -->
<div data-gadget="" class="main-interactor"
data-gadget-connection="[]">
</body>
</html>
\ No newline at end of file
This diff is collapsed.
......@@ -178,22 +178,22 @@ define([], function () {
// enhancing gadgets when everyone else is done
.on('render_enhance', function(e, data) {
var timer;
data.gadget.trigger("create");
// controlgroups inside popups
// this is a JQM controlgroup problem. Controlgroups include other widgets,
// so they are enhanced last after everything else has been enhanced.
// when inserting items dynamically and calling create, all widgets get
// enhanced, except for controlgroups which somestimes do, sometimes don't
// work. This is to make sure they work
// TODO: Find a better way
if (data.pops) {
timer = window.setTimeout(function () {
$('fieldset:jqmData(role="controlgroup")').parent().trigger("create");
window.clearTimeout(timer);
},1000);
}
// var timer;
// // data.gadget.trigger("create");
// // controlgroups inside popups
// // this is a JQM controlgroup problem. Controlgroups include other widgets,
// // so they are enhanced last after everything else has been enhanced.
// // when inserting items dynamically and calling create, all widgets get
// // enhanced, except for controlgroups which somestimes do, sometimes don't
// // work. This is to make sure they work
// // TODO: Find a better way
// if (data.pops) {
// timer = window.setTimeout(function () {
// $('fieldset:jqmData(role="controlgroup")').parent().trigger("create");
// window.clearTimeout(timer);
// },1000);
// }
//
// when first gadget is ready, remove the splash scren
$(window).trigger('initLoaded');
});
......
This diff is collapsed.
......@@ -691,6 +691,10 @@ var RenderJs = (function () {
};
}()),
Properties: {
foo: "bar"
},
InteractionGadget : (function () {
/*
* Basic gadget interaction gadget implementation.
......
This diff is collapsed.
......@@ -15,7 +15,6 @@
<div id="index_header" data-gadget="../gadgets/header.html" data-gadget-property='{"self": {"h1": ["data-i18n", "pages.titles.main"]}, "translator": {"a.setIcon": ["href", "#popup_index_lang"], "div.all_popups": ["id","popup_index_lang"]}}'></div>
<div data-role="content">
<div id="index_wrapper" data-gadget="../gadgets/index_wrapper.html"></div>
<div data-gadget="" class="main-interactor" data-gadget-connection="[{&quot;source&quot;: &quot;index_header.translate&quot;, &quot;destination&quot;: &quot;index_wrapper.translate&quot;}]"></div>
</div>
</div>
</body>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment