diff --git a/home.html b/home.html index c41d092..d80582e 100644 --- a/home.html +++ b/home.html @@ -185,7 +185,6 @@
    -
-
  • +
    +
  • user-photo
    @@ -391,7 +391,8 @@
    -
  • + +
    diff --git a/js/interface_common.js b/js/interface_common.js index d458682..f8b806d 100644 --- a/js/interface_common.js +++ b/js/interface_common.js @@ -2775,25 +2775,8 @@ function initInterfaceCommon() { $('.module.mini-profile .open-followers').on('mouseup', {route: '#followers'}, routeOnClick); $('.post-text').on('click', 'a', muteEvent); - $('.post-reply').on('click', postReplyClick); - $('.post-propagate').on('click', reTwistPopup); - $('.post-favorite').on('click', favPopup); $('.userMenu-config').clickoutside(closeThis.bind($('.config-menu'))); $('.userMenu-config-dropdown').on('click', dropDownMenu); - $('#post-template.module.post').on('click', function (event) { - if (event.button === 0 && window.getSelection() == 0) - postExpandFunction(event, $(this)); - }) - .find('.new-replies-available button').hide() - .on('click', function (event) { - event.stopPropagation(); - $(event.target).hide() - .closest('li.post').next('.post-replies').find('.post.pending') - .removeClass('pending').slideDown('fast') - ; - }) - .closest('.post-data').find('.post-stats').hide() - ; $('.post-area-new') .on('click', function (e) {composeNewPost(e, $(this));}) .clickoutside(unfocusPostAreaNew) @@ -2809,10 +2792,6 @@ function initInterfaceCommon() { $('.modal-propagate').on('click', retweetSubmit); $('.modal-fav-public').on('click', favSubmit); $('.modal-fav-private').on('click', favSubmit); - $('.expanded-content .show-more').on('mouseup', - {feeder: '.module.post.original.open .module.post.original .post-data'}, handleClickOpenConversation) - .on('click', muteEvent) // to prevent post collapsing - ; if ($.Options.unicodeConversion.val === 'disable') $('.undo-unicode').on('click', undoLastUnicode).css('display', 'none'); else @@ -2897,6 +2876,33 @@ function initInterfaceCommon() { } ) ; + + twister.tmpl.post = extractTemplate('#template-post') + .on('click', function (event) { + if (event.button === 0 && window.getSelection() == 0) + postExpandFunction(event, $(this)); + }) + ; + twister.tmpl.post.find('.post-reply').on('click', postReplyClick); + twister.tmpl.post.find('.post-propagate').on('click', reTwistPopup); + twister.tmpl.post.find('.post-favorite').on('click', favPopup); + twister.tmpl.post.find('.expanded-content .show-more') + .on('mouseup', + {feeder: '.module.post.original.open .module.post.original .post-data'}, + handleClickOpenConversation + ) + .on('click', muteEvent) // to prevent post collapsing + ; + twister.tmpl.post.find('.new-replies-available button').hide() + .on('click', function (event) { + event.stopPropagation(); + $(event.target).hide() + .closest('li.post').next('.post-replies').find('.post.pending') + .removeClass('pending').slideDown('fast') + ; + }) + ; + twister.tmpl.post.find('.post-stats').hide(); } function extractTemplate(selector) { diff --git a/js/interface_home.js b/js/interface_home.js index f2f4163..c558459 100644 --- a/js/interface_home.js +++ b/js/interface_home.js @@ -51,7 +51,7 @@ var InterfaceFunctions = function() { if (!defaultScreenName) { $('.userMenu-profile > a').attr('href', '#/login').text(polyglot.t('Login')); $(".post-area-new > textarea").attr("placeholder",polyglot.t("You have to log in to post messages.")); - $('.post-area-new > textarea').prop('disabled', true); + getElem('.post-area-new > textarea', true).prop('disabled', true); $miniProfile.find(".mini-profile-name").text("guest"); $miniProfile.find(".posts-count").text("0"); $miniProfile.find(".following-count").text("0"); diff --git a/js/mobile_abstract.js b/js/mobile_abstract.js index 72ab543..bc9377f 100644 --- a/js/mobile_abstract.js +++ b/js/mobile_abstract.js @@ -140,20 +140,6 @@ var MAL = function() } } - this.setPostTemplate = function(p) { - if( $.hasOwnProperty("mobile") ) { - this.postTemplate = p; - } - } - - this.getPostTemplate = function() { - if( $.hasOwnProperty("mobile") ) { - return this.postTemplate; - } else { - return $("#post-template"); - } - } - // how do we map usernames into urls this.userUrl = function(username) { //if( $.hasOwnProperty("mobile") ) { diff --git a/js/tmobile.js b/js/tmobile.js index f797c22..d64a061 100644 --- a/js/tmobile.js +++ b/js/tmobile.js @@ -5,6 +5,7 @@ var twisterInitialized = false; var handlersInstalled = false; + function initializeTwister( redirectNetwork, redirectLogin, cbFunc, cbArg ) { if( !handlersInstalled ) { interfaceNetworkHandlers(); @@ -18,7 +19,6 @@ function initializeTwister( redirectNetwork, redirectLogin, cbFunc, cbArg ) { }); // home screen timeline refresh button $('.timeline-refresh').on('click', function (e) { - $.MAL.setPostTemplate( $("#post-template-home") ); requestTimelineUpdate("latest",postsPerRefresh,followingUsers); $.mobile.silentScroll(0); }); @@ -31,6 +31,10 @@ function initializeTwister( redirectNetwork, redirectLogin, cbFunc, cbArg ) { ; handlersInstalled = true; + + twister.tmpl.post = extractTemplate('#template-post'); + twister.tmpl.postFull = extractTemplate('#template-post-full'); + twister.tmpl.postFull.find('.post-stats').hide(); } if( twisterInitialized ) { @@ -103,7 +107,6 @@ var router=new $.mobile.Router( cleanupStorage(); getFullname( defaultScreenName, $("#home .rtitle")); $(".mentions-count").attr("href","#mentions?user="+defaultScreenName ); - $.MAL.setPostTemplate( $("#post-template-home") ); requestTimelineUpdate("latestFirstTime",postsPerRefresh,followingUsers); } }); @@ -127,7 +130,6 @@ var router=new $.mobile.Router( } $.mobile.loading('show'); - $.MAL.setPostTemplate( $("#post-template-home") ); updateProfileData( $("#profile"), user); }); }, @@ -171,8 +173,7 @@ var router=new $.mobile.Router( initializeTwister( true, true, function() { var $ulPost = $("#post ul.posts"); $ulPost.text(""); - $.MAL.setPostTemplate( $("#post-template-post") ); - var originalLi = postToElem(JSON.parse(params.userpost), 'original'); + var originalLi = postToElem(JSON.parse(params.userpost), 'original', false, twister.tmpl.postFull); $ulPost.append(originalLi); $ulPost.find(".post-interactions").trigger('create'); $ulPost.listview('refresh'); @@ -201,7 +202,6 @@ var router=new $.mobile.Router( var $replyOriginal = $(".reply-original-post") $replyOriginal.html(""); if( params && params.hasOwnProperty("userpost") ) { - $.MAL.setPostTemplate( $("#post-template-home") ); var originalLi = postToElem(JSON.parse(params.userpost), 'original'); $replyOriginal.append(originalLi); $replyOriginal.listview('refresh'); @@ -215,7 +215,6 @@ var router=new $.mobile.Router( initializeTwister( true, true, function() { var $rtOriginal = $(".rt-original-post") $rtOriginal.html(""); - $.MAL.setPostTemplate( $("#post-template-home") ); var originalLi = postToElem(JSON.parse(params.userpost), 'original'); $rtOriginal.append(originalLi); $rtOriginal.listview('refresh'); @@ -521,7 +520,6 @@ function reachedScrollBottom() { var curPage = $.mobile.activePage.attr("id"); if( curPage == "home" ) { if( timelineLoaded ) { - $.MAL.setPostTemplate( $("#post-template-home") ); requestTimelineUpdate("older", postsPerRefresh, followingUsers); } } @@ -544,7 +542,6 @@ function encode_utf8(s) { var tmobileQueryReq; function setupHashtagOrMention(board, query, resource) { - $.MAL.setPostTemplate( $("#post-template-home") ); $.mobile.loading('show'); board.empty(); diff --git a/js/twister_formatpost.js b/js/twister_formatpost.js index ffab325..253d799 100644 --- a/js/twister_formatpost.js +++ b/js/twister_formatpost.js @@ -30,7 +30,7 @@ $(function () { // format "userpost" to html element // kind = "original"/"ancestor"/"descendant" -function postToElem(post, kind, promoted) { +function postToElem(post, kind, promoted, templatePost) { /* "userpost" : { @@ -99,8 +99,11 @@ function postToElem(post, kind, promoted) { msg = msg.slice(0,$.Options.MaxPostDisplayChars.val) + "\u2026"; } + if (!templatePost) + templatePost = twister.tmpl.post; + // Now create the html elements - var elem = $.MAL.getPostTemplate().clone(true).appendTo(twister.html.detached); + var elem = templatePost.clone(true).appendTo(twister.html.detached); elem.removeAttr('id') .addClass(kind) .attr('data-time', time) diff --git a/tmobile.html b/tmobile.html index ccb9767..69d8d9b 100644 --- a/tmobile.html +++ b/tmobile.html @@ -738,7 +738,8 @@
    -
  • +
    +
  • user-photo
    @@ -750,7 +751,8 @@

    -
  • + +
    @@ -765,7 +767,8 @@ shorten URL
    -
  • +
    +
  • user-photo
    @@ -795,7 +798,8 @@
  • - + +