Update of /var/cvs/contributions/didactor2/src/core/templates/core/js
In directory james.mmbase.org:/tmp/cvs-serv22801
Modified Files:
Didactor.js
Log Message:
Don't hide/show learnblock impletecly but only remove/add a class, so that you
can decide via CSS what to do
See also:
http://cvs.mmbase.org/viewcvs/contributions/didactor2/src/core/templates/core/js
Index: Didactor.js
===================================================================
RCS file:
/var/cvs/contributions/didactor2/src/core/templates/core/js/Didactor.js,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- Didactor.js 6 Mar 2009 11:20:39 -0000 1.21
+++ Didactor.js 6 Mar 2009 16:29:52 -0000 1.22
@@ -6,7 +6,7 @@
* One global variable 'didactor' is automaticly created, which can be be
referenced (as long as the di:head tag is used).
* @since Didactor 2.3.0
* @author Michiel Meeuwissen
- * @version $Id: Didactor.js,v 1.21 2009/03/06 11:20:39 michiel Exp $
+ * @version $Id: Didactor.js,v 1.22 2009/03/06 16:29:52 michiel Exp $
*/
@@ -24,11 +24,7 @@
self.fragments = [];
{
- var url = document.location.href;
- var fragmentIndex = url.indexOf('#');
- if (fragmentIndex > 0) {
- self.fragments = url.substring(fragmentIndex + 1).split('_');
- }
+ self.fillFragments();
if (self.fragments.length > 0) {
self.openContent(self.fragments[0]);
}
@@ -90,26 +86,22 @@
$(document).bind("didactorContent", function(ev, data) {
var url = document.location.href;
- var fragmentIndex = url.indexOf('#');
- var fragment = url.substring(fragmentIndex);
- var i = fragment.indexOf('learnblock_');
- if (i > -1) {
- learnblock = fragment;
- }
+ self.fillFragments();
$(".subnavigationPage ul.navigation li").each(function() {
var href = $(this).find("a")[0].href;
var i = href.indexOf('#');
var anchor = href.substring(i) + "_block";
if (self.learnblock == null) {
self.learnblock = anchor;
+ $(self.learnblock).addClass("active");
}
-
+ var li = this;
$(this).click(function() {
$(".subnavigationPage ul.navigation
li").removeClass("active");
$(this).addClass("active");
- $(self.learnblock).hide();
+ $(self.learnblock).removeClass("active");
self.learnblock = anchor;
- $(self.learnblock).show();
+ $(self.learnblock).addClass("active");
document.location.href = href;
return false;
});
@@ -157,6 +149,14 @@
this.content = c;
}
+Didactor.prototype.fillFragments = function() {
+ var url = document.location.href;
+ var fragmentIndex = url.indexOf('#');
+ if (fragmentIndex > 0) {
+ this.fragments = url.substring(fragmentIndex + 1).split('_');
+ }
+}
+
Didactor.prototype.setUpQuestionEvents = function(div) {
var did = this;
$(div).find("div.question").each(function() {
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs