*
*/
-
-
MTrack = {
init : function()
{
Roo.onReady(function () {
- MTrack.footerSetAndWait();
+ //MTrack.footerSetAndWait();
if (authUser) {
- setTimeout(MTrack.keepLoggedIn, 30000);
+ window.setTimeout(MTrack.keepLoggedIn, 30000);
}
url : window.location.pathname + window.location.search,
params: { ajax_body : 1 } ,
success : function (data) {
- Roo.log(data);
-
- $('#ajaxbody').html(data);
- MTrack.addHandlers($('#ajaxbody'));
- MTrack.missingHashes($('#ajaxbody'), href)
+ var ab = Roo.get('ajaxbody');
+ ab.dom.innerHTML = data.responseText;
+ MTrack.addHandlers(ab);
+ MTrack.missingHashes(ab, href)
}
});
});
});
},
+
addHandlers : function (toWhat)
{
// forEach? - no IE support?
toWhat = toWhat || document.body; //
// run the main registry
- MTrack.registry.forEach(function(cfg) {
- var el = Roo.get(toWhat).select(cfg.selector,true)
- el[cfg.method].apply(el, cfg.event ? [ cfg.event, cfg.args ] : [ cfg.args ] );
+ Roo.each(MTrack.registry, function(cfg) {
+ //Roo.log("Add select:" + cfg.selector);
+ try {
+ var el = Roo.get(toWhat).select(cfg.selector,true)
+ el[cfg.method].apply(el, cfg.event ? [ cfg.event, cfg.args ] : [ cfg.args ] );
+ } catch(e) {
+ Roo.log("Error applying select:" + cfg.selector);
+ Roo.log(e);
+ // do not throw any more..
+
+ }
});
// any other weird crap goes here.
ajaxLoad : function(url,slideleft)
{
+ Roo.get(document.body).scrollTo('top',0,true);
this.currentURL = url;
var target = Roo.get("ajaxbody");
var content = Roo.get("content");
Roo.select('.mask').show(); // must show first?
Roo.select('.mask-loading').show();
// content has a border...
- var t = content.getBox().top - Roo.get(document).getScroll().top - 13;
- var l = content.getBox().left - Roo.get(document).getScroll().top - 13;
+ var t = content.getBox().y ;// - Roo.get(document).getScroll().top;// - 13;
+ var l = content.getBox().x ;// - Roo.get(document).getScroll().left;// - 13;
var w = content.getBox().width+ 26;
var h = content.getBox().height + 26;
l + ( w / 2) - 16, t + 16
);
- if (MTrack.missingHashRequest) {
- MTrack.missingHashRequest.abort();
- MTrack.missingHashRequest = false;
- }
+ //if (MTrack.missingHashRequest) {
+ Roo.Ajax.abort();
+ // MTrack.missingHashRequest = false;
+ //}
Roo.get('loader').hide();
+ Roo.get('loader').setStyle('position', 'relative');
Roo.Ajax.request({
+ method: 'GET',
url : baseURL + url,
params : { ajax_body : 1 },
success : function(data) {
Roo.select('.mask').hide();
- Roo.get('loader').update(data);
+ Roo.get('loader').update(data.responseText);
Roo.get('loader').show();
Roo.get('loader').setWidth( w );
- Roo.get('loader').setPosition( slideleft? l+w : l-w , t );
+ Roo.get('loader').setLocation( slideleft? l+w : l-w , t );
+ // old layer - move it away..
target.animate(
{
- left: slideleft ? -1 * w : w
+ left: { from : 0 , to : slideleft ? -1 * w : w }
},
.5,
function() {
- target.setPosition( 0, 0 ); // reset it at end of animation - as it ends up with the new content.
- }
+ // reset it at end of animation - as it ends up with the new content.
+ //target.setLocation( 0 , t );
+ },
+ 'easeOut', 'motion'
);
Roo.get('loader').animate(
{
- left: l+13
+ left: { from : slideleft? l+w : l-w , to : l }
},
.5,
function () {
Roo.get('loader').hide();
Roo.get('loader').update("");
target.show();// make sure!!
-
+ target.setLocation( l ,t );
+
MTrack.missingHashes(target, url);
MTrack.addHandlers(target);
- }
+ // scroll up...
+
+ },
+ 'easeOut', 'motion'
);
}
//console.log('loaded dif');
missingHashRequest : false,
missingHashes: function(el,url) {
- //console.log('finding missing hashes?');
+ console.log('finding missing hashes?');
var hashes = [];
el.select('.browse-missing-hash').each(function() {
hashes.push(this.dom.id);
});
+
if (!hashes.length) {
+ Roo.log("no missing hashes");
return;
}
- if (MTrack.missingHashRequest) {
- MTrack.missingHashRequest.abort();
- }
- MTrack.missingHashRequest = Roo.Ajax.request({
+ Roo.Ajax.abort();
+ Roo.Ajax.request({
method : 'POST',
url : baseURL + url,
params : { hashes : hashes.join(',') },
- success : function(data) {
+ success : function(res) {
+ var data = Roo.decode(res.responseText);
+
//console.log(data.data);
if (data.data) {
for(var hash in data.data) {
last_wh : false,
footerPosition : function (force) {
+ return;
var ele = Roo.get('footer');
if (!force &&
- (Mtrack.last_dh != Roo.lib.Dom.getDocumentHeight() || Mtrack.last_wh != Roo.lib.Dom.getViewHeight())) {
+ (MTrack.last_dh != Roo.lib.Dom.getDocumentHeight() || MTrack.last_wh != Roo.lib.Dom.getViewHeight())) {
force = true;
}
position: "absolute",
"margin-top": "0",
top: (
- Roo.get(window).getScroll().top +
+ Roo.get(document).getScroll().top +
Roo.lib.Dom.getViewHeight() -
ele.getSize().height - 1
)+"px"
"margin-top": "3em"
});
}
- Mtrack.last_dh = Roo.lib.Dom.getDocumentHeight();
- Mtrack.last_wh = Roo.lib.Dom.getViewHeight();
+ MTrack.last_dh = Roo.lib.Dom.getDocumentHeight();
+ MTrack.last_wh = Roo.lib.Dom.getViewHeight();
},
+
+ keepLoggedIn: function()
+ {
+ Roo.Ajax.request({
+ url : baseURL + '/Login.html',
+ method: 'POST',
+ data : { refresh : 1 },
+ success : function() {
+
+ window.setTimeout(MTrack.keepLoggedIn, 30000);
+ // what if it's false..currentURL = false;
+
+
+ }
+
+ })
+
+
+
+ },
/*
$(window)
*/
footerSetAndWait : function () {
- this.footerPosition();
- setTimeout(function () {
- footerSetAndWait();
+ return;
+ /*this.footerPosition();
+ window.setTimeout(function () {
+ MTrack.footerSetAndWait();
}, 1500);
+ */
}
Roo.select('#banner select').on('change', function(e) {
// ajax change project, and refresh body..
Roo.Ajax.request({
- url : baseURL + '/Project.html',
+ method: 'GET',
+ url : baseURL + '/core_project',
params : { active_project_id : this.value },
success : function() {
// what if it's false..currentURL = false;
});
-
+ MTrack.init();
try {
window.onpopstate = function(ev) {
{
event.preventDefault();
- var href= this.getAttribute('href').substring(baseURL.length);
+ var href= this.dom.getAttribute('href').substring(baseURL.length);
try {
- window.history.pushState( { url: href }, "Browse : " + href , this.href );
- } catch (e) {}
- var slideleft = $(this).is('.browse-link-up') ? 0 : 1;
+ window.history.pushState( { url: href }, "Browse : " + href , this.dom.href );
+ Roo.log("history push state");
+ } catch (e) {
+ Roo.log(e);
+
+ }
+ var slideleft = this.is('.browse-link-up') ? 0 : 1;
MTrack.ajaxLoad(href,slideleft);
});
{separator:'---------------' },
{name:'Quotes', openWith:'(!(> |!|>)!)'},
{name:'Code', openWith:'{{{\\n', closeWith:'\\n}}}'},
- {separator:'---------------' },
+ {separator:'---------------' },1
{name:'Preview', call:'preview', className:'preview'}
]
});
$('input[title!=""]').mtrackWatermark();
- // Arrange for the footer to sink to the bottom of the window, if the window
- // contents are not very tall
- var last_dh = 0;
- var last_wh = 0;
- function mtrack_footer_position(force) {
- var ele = $('#footer');
- if (!force &&
- (last_dh != $(document).height() || last_wh != $(window).height)) {
- force = true;
- }
- if (force) {
- // Force a from-scratch layout assessment; put the footer back in
- // it's natural location in the doc
- ele.css({
- position: "relative",
- "margin-top": "3em",
- top: 0
- });
- }
- if ($(document).height() <= $(window).height()) {
- ele.css({
- position: "absolute",
- "margin-top": "0",
- top: (
- $(window).scrollTop() +
- $(window).height() -
- ele.height() - 1
- )+"px"
- });
- } else {
- ele.css({
- position: "relative",
- "margin-top": "3em"
- });
- }
- last_dh = $(document).height();
- last_wh = $(window).height();
- }
- window.mtrack_footer_position = mtrack_footer_position;
- $(window)
- .scroll(mtrack_footer_position)
- .resize(mtrack_footer_position);
- function mtrack_footer_set_and_wait() {
- mtrack_footer_position();
- setTimeout(function () {
- mtrack_footer_set_and_wait();
- }, 1500);
- }
- mtrack_footer_set_and_wait();
+
});