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

refactor - autonomize

parent c9aeaf90
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
@media all and (min-width: 60em) { @media all and (min-width: 60em) {
#about_info .about_element_wrapper {max-width: 70%;} #about_info .about_element_wrapper {max-width: 70%;}
} }
</style> </style>
</head> </head>
<body> <body>
......
...@@ -24,43 +24,17 @@ ...@@ -24,43 +24,17 @@
<script type="text/javascript"> <script type="text/javascript">
//<![CDATA[ //<![CDATA[
(function () { (function () {
var gadget = RenderJs.getSelfGadget(), /* initialize translation */
recursive_gadgets = gadget.dom.find("[data-gadget]").not(".main-interactor"), var gadget = RenderJs.getSelfGadget();
len = recursive_gadgets.length;
recursive_gadgets.each(function (i) { RenderJs.bindReady(function () {
var passJSON = gadget[$(this).attr('id')], // trigger create
string, new_string, if (gadget.isEnhanced() === undefined || gadget.isEnhanced() === false) {
current_id = $(this).attr('id'), gadget.dom.trigger("create");
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)+'}');
} }
// 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 $(document).ready(function() { });
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});
});
})(); })();
//]]> //]]>
</script> </script>
......
...@@ -4,13 +4,9 @@ ...@@ -4,13 +4,9 @@
<head> <head>
</head> </head>
<body> <body>
<div id="index_configure" data-gadget="../gadgets/configure.html"></div> <div id="configure" data-gadget="../gadgets/configure.html"></div>
<div id="index_social" data-gadget="../gadgets/social.html"></div> <div id="social" data-gadget="../gadgets/social.html"></div>
<div id="index_nav" data-gadget="../gadgets/navigation.html"></div> <div id="nav" data-gadget="../gadgets/navigation.html"></div>
<p class="mini t" data-i18n="gen.disclaimer"></p> <p class="mini t" data-i18n="gen.disclaimer"></p>
<!-- interactions -->
<div data-gadget="" class="main-interactor"
data-gadget-connection="[]">
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -13,8 +13,5 @@ ...@@ -13,8 +13,5 @@
<div id="legal_info" data-gadget="../gadgets/legal.html"></div> <div id="legal_info" data-gadget="../gadgets/legal.html"></div>
<div id="legal_social" data-gadget="../gadgets/social.html"></div> <div id="legal_social" data-gadget="../gadgets/social.html"></div>
<div id="legal_nav" data-gadget="../gadgets/navigation.html"></div> <div id="legal_nav" data-gadget="../gadgets/navigation.html"></div>
<!-- interactions -->
<div data-gadget="" class="main-interactor"
data-gadget-connection="[]">
</body> </body>
</html> </html>
\ No newline at end of file
This diff is collapsed.
...@@ -178,22 +178,22 @@ define([], function () { ...@@ -178,22 +178,22 @@ define([], function () {
// enhancing gadgets when everyone else is done // enhancing gadgets when everyone else is done
.on('render_enhance', function(e, data) { .on('render_enhance', function(e, data) {
var timer; // var timer;
data.gadget.trigger("create"); // // data.gadget.trigger("create");
// controlgroups inside popups // // controlgroups inside popups
// this is a JQM controlgroup problem. Controlgroups include other widgets, // // this is a JQM controlgroup problem. Controlgroups include other widgets,
// so they are enhanced last after everything else has been enhanced. // // so they are enhanced last after everything else has been enhanced.
// when inserting items dynamically and calling create, all widgets get // // when inserting items dynamically and calling create, all widgets get
// enhanced, except for controlgroups which somestimes do, sometimes don't // // enhanced, except for controlgroups which somestimes do, sometimes don't
// work. This is to make sure they work // // work. This is to make sure they work
// TODO: Find a better way // // TODO: Find a better way
if (data.pops) { // if (data.pops) {
timer = window.setTimeout(function () { // timer = window.setTimeout(function () {
$('fieldset:jqmData(role="controlgroup")').parent().trigger("create"); // $('fieldset:jqmData(role="controlgroup")').parent().trigger("create");
window.clearTimeout(timer); // window.clearTimeout(timer);
},1000); // },1000);
} // }
//
// when first gadget is ready, remove the splash scren // when first gadget is ready, remove the splash scren
$(window).trigger('initLoaded'); $(window).trigger('initLoaded');
}); });
......
This diff is collapsed.
...@@ -691,6 +691,10 @@ var RenderJs = (function () { ...@@ -691,6 +691,10 @@ var RenderJs = (function () {
}; };
}()), }()),
Properties: {
foo: "bar"
},
InteractionGadget : (function () { InteractionGadget : (function () {
/* /*
* Basic gadget interaction gadget implementation. * Basic gadget interaction gadget implementation.
......
This diff is collapsed.
...@@ -15,7 +15,6 @@ ...@@ -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 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 data-role="content">
<div id="index_wrapper" data-gadget="../gadgets/index_wrapper.html"></div> <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>
</div> </div>
</body> </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