Browse Source

update jQuery to 3.3.1 (and 1.12.4 for tmobile)

readme-update
Simon Grim 6 years ago
parent
commit
4c4666f221
  1. 3
      abort.html
  2. 3
      home.html
  3. 2
      index.html
  4. 6
      js/calm.js
  5. 53
      js/interface_common.js
  6. 26
      js/interface_home.js
  7. 4
      js/interface_localization.js
  8. 4
      js/interface_profile-edit.js
  9. 4
      js/jQueryPlugins.js
  10. 5
      js/jquery-1.12.4.min.js
  11. 5
      js/jquery-1.9.1.min.js
  12. 2
      js/jquery-3.3.1.min.js
  13. 200
      js/jquery.json-2.4.js
  14. 30
      js/jquery.jsonrpcclient.js
  15. 5
      js/jquery.min.js
  16. 4
      js/jquery.textcomplete.min.js
  17. 24
      js/mobile_abstract.js
  18. 2
      js/options.js
  19. 82
      js/tmobile.js
  20. 12
      js/twister_actions.js
  21. 8
      js/twister_directmsg.js
  22. 12
      js/twister_formatpost.js
  23. 2
      js/twister_io.js
  24. 13
      js/twister_network.js
  25. 3
      network.html
  26. 3
      options.html
  27. 3
      profile-edit.html
  28. 12
      theme_nin/js/theme_option.js
  29. 3
      tmobile.html

3
abort.html

@ -4,9 +4,8 @@ @@ -4,9 +4,8 @@
<meta charset="utf-8"/>
<title>Aborting...</title>
<link id="stylecss" rel="stylesheet" href="css/style.css"/>
<script src="js/jquery.min.js"></script>
<script src="js/jquery-3.3.1.min.js"></script>
<script src="js/jQueryPlugins.js"></script>
<script src="js/jquery.json-2.4.js"></script>
<script src="js/jquery.jsonrpcclient.js"></script>
<script src="js/jquery.storageapi.js"></script>
<script src="js/options.js"></script>

3
home.html

@ -5,9 +5,8 @@ @@ -5,9 +5,8 @@
<title>twister</title>
<link id="stylecss" rel="stylesheet" href="css/style.css" type="text/css"/>
<link id="profilecss" rel="stylesheet" href="css/profile.css" type="text/css"/>
<script src="js/jquery.min.js"></script>
<script src="js/jquery-3.3.1.min.js"></script>
<script src="js/jQueryPlugins.js"></script>
<script src="js/jquery.json-2.4.js"></script>
<script src="js/jquery.jsonrpcclient.js"></script>
<script src="js/jquery.storageapi.js"></script>
<script src="js/options.js"></script>

2
index.html

@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
<meta name="viewport" content="width=device-width, user-scalable=no"/>
<link rel="stylesheet" href="css/jquery.mobile-1.3.2.min.css" />
<script src="js/jquery-1.9.1.min.js"></script>
<script src="js/jquery-1.12.4.min.js"></script>
<script src="js/jquery.mobile.router.min.js"></script>
<script src="js/jquery.mobile-1.3.2.min.js"></script>

6
js/calm.js

@ -1,13 +1,13 @@ @@ -1,13 +1,13 @@
$(function(){
$('#showqr').on('click', function(){
$('#showqr').on('click', function () {
if($('#qrcode img')[0]) return;
var skey = document.getElementById('skey').innerText;
new QRCode(document.getElementById("qrcode"), skey);
});
$('.tox-ctc').on('click', function(){
$('.tox-ctc').on('click', function () {
window.prompt('Press Ctrl/Cmd+C to copy then Enter to close', $(this).attr('data'))
})
$('.bitmessage-ctc').on('click', function(){
$('.bitmessage-ctc').on('click', function () {
window.prompt('Press Ctrl/Cmd+C to copy then Enter to close', $(this).attr('data'))
})
})

53
js/interface_common.js

@ -95,8 +95,9 @@ function openModal(modal) { @@ -95,8 +95,9 @@ function openModal(modal) {
modal.drapper = $('<div>').appendTo(twister.html.detached); // here modal goes instead detaching
modal.content.outerHeight(modal.self.height() - modal.self.find('.modal-header').outerHeight()
- modal.self.find('.inline-warn').outerHeight()
* (modal.warn && !$.Options.get('skipWarn' + modal.warn.name) ? 1 : 0));
- (modal.warn && !$.Options.get('skipWarn' + modal.warn.name) ?
modal.self.find('.inline-warn').outerHeight() : 0)
);
var windowHeight = $(window).height();
if (modal.self.outerHeight() > windowHeight) {
@ -191,7 +192,7 @@ function minimizeModal(modal, switchMode) { @@ -191,7 +192,7 @@ function minimizeModal(modal, switchMode) {
twister.modal[i].scroll = scroll;
twister.modal[i].btnResume = $('<li>' + modal.find('.modal-header h3').text() + '</li>')
.on('click', {hashString: window.location.hash}, function (event) {
if (!event.button) // only if left mouse (button is 0) or elem.click() (button is undefined)
if (!event.button) // only if left mouse (button is 0) or elem.trigger('click') (button is undefined)
resumeModal(event);
})
.on('mouseup', {route: window.location.hash, blankOnly: true}, routeOnClick)
@ -277,7 +278,7 @@ function focusModalWithElement(elem, cbFunc, cbReq) { @@ -277,7 +278,7 @@ function focusModalWithElement(elem, cbFunc, cbReq) {
if (typeof i === 'object') i = i[0]; // several modals, but only one may be active currently
twister.modal[i].onResume = cbFunc;
twister.modal[i].onResumeReq = cbReq;
twister.modal[i].btnResume.click();
twister.modal[i].btnResume.trigger('click');
return true;
}
@ -557,7 +558,7 @@ function openGroupProfileModalWithNameHandler(groupAlias) { @@ -557,7 +558,7 @@ function openGroupProfileModalWithNameHandler(groupAlias) {
;
if (ret.members.indexOf(defaultScreenName) !== -1)
req.modal.content.find('.group-messages-control').children('button').attr('disabled', false);
req.modal.content.find('.group-messages-control').children('button').prop('disabled', false);
var membersList = req.modal.content.find('.members');
var memberTemplate = $('#group-profile-member-template').children();
@ -1246,7 +1247,7 @@ function routeOnClick(event) { @@ -1246,7 +1247,7 @@ function routeOnClick(event) {
.bind({elem: event.target, href: event.target.getAttribute('href')}), 200);
event.target.removeAttribute('href');
}
twister.html.blanka.attr('href', event.data.route)[0].click(); // opens .route in new tab
twister.html.blanka.attr('href', event.data.route)[0].trigger('click'); // opens .route in new tab
}
if (!event || !event.data || !event.data.route)
@ -1300,10 +1301,10 @@ function watchHashChange(event) { @@ -1300,10 +1301,10 @@ function watchHashChange(event) {
function loadModalFromHash() {
var i = window.location.hash;
if (twister.modal[i] && twister.modal[i].minimized) {
// need to close active modal(s) before btnResume.click() or it will be minimized in resumeModal()
// need to close active modal(s) before btnResume.trigger('click') or it will be minimized in resumeModal()
// e.g. for case when you click on profile link in some modal having this profile's modal minimized already
closeModal(undefined, true);
twister.modal[i].btnResume.click();
twister.modal[i].btnResume.trigger('click');
return;
}
@ -1396,7 +1397,7 @@ function reTwistPopup(event, post, textArea) { @@ -1396,7 +1397,7 @@ function reTwistPopup(event, post, textArea) {
}
if (typeof post === 'undefined')
post = $.evalJSON($(event.target).closest('.post-data').attr('data-userpost'));
post = JSON.parse($(event.target).closest('.post-data').attr('data-userpost'));
var modal = openModal({
classBase: '.prompt-wrapper',
@ -1430,7 +1431,7 @@ function reTwistPopup(event, post, textArea) { @@ -1430,7 +1431,7 @@ function reTwistPopup(event, post, textArea) {
} else {
replyArea.find('textarea').replaceWith(textArea);
if (textArea.val()) {
textArea.focus();
textArea.trigger('focus');
replyArea.addClass('open');
}
}
@ -1448,7 +1449,7 @@ function favPopup(event, post, textArea) { @@ -1448,7 +1449,7 @@ function favPopup(event, post, textArea) {
}
if (typeof post === 'undefined')
post = $.evalJSON($(event.target).closest('.post-data').attr('data-userpost'));
post = JSON.parse($(event.target).closest('.post-data').attr('data-userpost'));
var modal = openModal({
classBase: '.prompt-wrapper',
@ -1472,7 +1473,7 @@ function favPopup(event, post, textArea) { @@ -1472,7 +1473,7 @@ function favPopup(event, post, textArea) {
} else {
replyArea.find('textarea').replaceWith(textArea);
if (textArea.val()) {
textArea.focus();
textArea.trigger('focus');
replyArea.addClass('open');
}
}
@ -1734,7 +1735,7 @@ function postReplyClick(event) { @@ -1734,7 +1735,7 @@ function postReplyClick(event) {
var post = $(this).closest('.post');
if (!post.hasClass('original'))
replyInitPopup(event, $.evalJSON(post.find('.post-data').attr('data-userpost')));
replyInitPopup(event, JSON.parse(post.find('.post-data').attr('data-userpost')));
else {
if (!post.closest('.post.open').length)
postExpandFunction(event, post);
@ -1774,7 +1775,7 @@ function composeNewPost(e, postAreaNew) { @@ -1774,7 +1775,7 @@ function composeNewPost(e, postAreaNew) {
poseTextareaPostTools(textArea);
}
if (!postAreaNew.find('textarea:focus').length)
postAreaNew.find('textarea:last').focus();
postAreaNew.find('textarea:last').trigger('focus');
}
function poseTextareaPostTools(event) {
@ -1920,7 +1921,7 @@ function replyTextInput(event) { @@ -1920,7 +1921,7 @@ function replyTextInput(event) {
if (typeof targetta !== 'undefined' && targetta[0] !== document.activeElement) {
textArea = targetta;
textArea.focus();
textArea.trigger('focus');
textArea.caret(caretPos);
}
}
@ -2036,7 +2037,7 @@ function replyTextKeySend(event) { @@ -2036,7 +2037,7 @@ function replyTextKeySend(event) {
textArea.val(textArea.val().trim());
if (!buttonSend.hasClass('disabled'))
buttonSend.click();
buttonSend.trigger('click');
}
}
}
@ -2461,7 +2462,7 @@ function postSubmit(e, oldLastPostId) { @@ -2461,7 +2462,7 @@ function postSubmit(e, oldLastPostId) {
if (btnPostSubmit.hasClass('with-reference')) {
var doSubmitPost = function (postText, postDataElem) {
newRtMsg($.evalJSON(postDataElem.attr('data-content_to_rt')),
newRtMsg(JSON.parse(postDataElem.attr('data-content_to_rt')),
postDataElem.attr('data-content_to_sigrt'), postText, updateRTsWithOwnOne
);
};
@ -2573,7 +2574,7 @@ function postSubmit(e, oldLastPostId) { @@ -2573,7 +2574,7 @@ function postSubmit(e, oldLastPostId) {
if (btnPostSubmit.closest('.post-area,.post-reply-content').length) {
btnPostSubmit.closest('.post-area-new').removeClass('open')
.find('textarea').blur();
.find('textarea').trigger('blur');
}
textArea.data('unicodeConversionStack', []);
textArea.data('disabledUnicodeRules', []);
@ -2587,7 +2588,7 @@ function retweetSubmit(event) { @@ -2587,7 +2588,7 @@ function retweetSubmit(event) {
var prompt = $(event.target).closest('.prompt-wrapper');
var postDataElem = prompt.find('.post-data');
newRtMsg($.evalJSON(postDataElem.attr('data-content_to_rt')),
newRtMsg(JSON.parse(postDataElem.attr('data-content_to_rt')),
postDataElem.attr('data-content_to_sigrt'), '', updateRTsWithOwnOne
);
@ -2626,7 +2627,7 @@ function changeStyle() { @@ -2626,7 +2627,7 @@ function changeStyle() {
$('#profilecss').attr('href', profile);
$('<style type="text/css"> .selectable_theme:not(.theme_' + theme + ')' +
'{display:none!important;}\n</style>').appendTo('head');
setTimeout(function() {$(menu).removeAttr('style');}, 0);
setTimeout(function() {console.log($(menu)); $(menu).removeAttr('style');}, 0);
}
function getMentionsForAutoComplete() {
@ -2779,7 +2780,7 @@ function initInterfaceCommon() { @@ -2779,7 +2780,7 @@ function initInterfaceCommon() {
$('.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) {
$('#post-template.module.post').on('click', function (event) {
if (event.button === 0 && window.getSelection() == 0)
postExpandFunction(event, $(this));
})
@ -2794,7 +2795,7 @@ function initInterfaceCommon() { @@ -2794,7 +2795,7 @@ function initInterfaceCommon() {
.closest('.post-data').find('.post-stats').hide()
;
$('.post-area-new')
.on('click', function(e) {composeNewPost(e, $(this));})
.on('click', function (e) {composeNewPost(e, $(this));})
.clickoutside(unfocusPostAreaNew)
.children('textarea')
.on({
@ -2830,7 +2831,7 @@ function initInterfaceCommon() { @@ -2830,7 +2831,7 @@ function initInterfaceCommon() {
{feeder: '.latest-activity'}, handleClickOpenConversation);
replaceDashboards();
$(window).resize(replaceDashboards);
$(window).on('resize', replaceDashboards);
$('.profile-card .profile-bio .group-description')
.on('focus', function (event) {
@ -2928,7 +2929,7 @@ function elemFitNextIntoParentHeight(elem) { @@ -2928,7 +2929,7 @@ function elemFitNextIntoParentHeight(elem) {
function inputEnterActivator(event) {
var elemEvent = $(event.target);
elemEvent.closest(event.data.parentSelector).find(event.data.enterSelector)
.attr('disabled', elemEvent.val().trim() === '');
.prop('disabled', elemEvent.val().trim() === '');
}
function pasteToTextarea(ta, p) {
@ -2947,7 +2948,7 @@ function pasteToTextarea(ta, p) { @@ -2947,7 +2948,7 @@ function pasteToTextarea(ta, p) {
} else
ta.val(p + ' ');
ta.focus().caret(c + p.length + ((ta.val().length - s.length - p.length) > 1 ? 2 : 1));
ta.trigger('focus').caret(c + p.length + ((ta.val().length - s.length - p.length) > 1 ? 2 : 1));
}
function setTextcompleteOnEventTarget(event) {
@ -2984,7 +2985,7 @@ function setTextcompleteDropdownListPos(position) { @@ -2984,7 +2985,7 @@ function setTextcompleteDropdownListPos(position) {
return this;
}
$(document).ready(function () {
$(function () {
setupTimeGmtToText($.Options.locLang.val);
if ($.localStorage.isSet('twistaURIs'))
twister.URIs = $.localStorage.get('twistaURIs');

26
js/interface_home.js

@ -10,7 +10,7 @@ var InterfaceFunctions = function() { @@ -10,7 +10,7 @@ var InterfaceFunctions = function() {
//faço os binds no init
this.init = function()
{
$( ".wrapper .postboard-news").click(function() {
$('.wrapper .postboard-news').on('click', function () {
var newPosts = parseInt($(".userMenu .menu-news").text());
if (!newPosts)
newPosts = postsPerRefresh;
@ -18,14 +18,14 @@ var InterfaceFunctions = function() { @@ -18,14 +18,14 @@ var InterfaceFunctions = function() {
});
// Add refresh posts for home link in menu
$( ".userMenu-home.current a").click(function() {
$('.userMenu-home.current a').on('click', function () {
var newPosts = parseInt($(".userMenu .menu-news").text());
if (!newPosts)
newPosts = postsPerRefresh;
requestTimelineUpdate('pending',newPosts,followingUsers,promotedPostsOnly);
});
$( ".promoted-posts-only").click(function() {
$('.promoted-posts-only').on('click', function () {
promotedPostsOnly = !promotedPostsOnly;
timelineChangedUser();
@ -51,13 +51,13 @@ var InterfaceFunctions = function() { @@ -51,13 +51,13 @@ 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").attr("disabled","true");
$('.post-area-new > textarea').prop('disabled', true);
$miniProfile.find(".mini-profile-name").text("guest");
$miniProfile.find(".posts-count").text("0");
$miniProfile.find(".following-count").text("0");
$miniProfile.find(".followers-count").text("0");
$(".dropdown-menu-following").attr("href","#");
$(".dropdown-menu-following").bind("click", function()
$('.dropdown-menu-following').on('click', function ()
{ alert(polyglot.t("You are not following anyone because you are not logged in."))} );
} else {
$miniProfile.find("a.mini-profile-name").attr("href",$.MAL.userUrl(defaultScreenName));
@ -80,7 +80,7 @@ var InterfaceFunctions = function() { @@ -80,7 +80,7 @@ var InterfaceFunctions = function() {
requestTimelineUpdate("latestFirstTime",postsPerRefresh,followingUsers,promotedPostsOnly);
// install scrollbottom handler to load more posts as needed
$(window).scroll(function(){
$(window).on('scroll', function () {
if ($(window).scrollTop() >= $(document).height() - $(window).height() - 20){
if( timelineLoaded ) {
requestTimelineUpdate("older", postsPerRefresh, followingUsers, promotedPostsOnly);
@ -125,7 +125,7 @@ function initTopTrends() { @@ -125,7 +125,7 @@ function initTopTrends() {
if ($tt.length) {
var $ttRefresh = $tt.find('.refresh-toptrends');
$ttRefresh.on('click', updateTrendingHashtags);
setTimeout(function() { $ttRefresh.click() }, 100);
setTimeout(function (req) {req.trigger('click');}, 100, $ttRefresh);
}
}
@ -184,8 +184,8 @@ function initWhoToFollow() { @@ -184,8 +184,8 @@ function initWhoToFollow() {
if (wtf.length) {
var wtfRefresh = wtf.find('.refresh-users');
wtfRefresh.on('click', refreshWhoToFollow);
setTimeout(function() {wtfRefresh.click();}, 100);
//wtf.find('.view-all-users').on('click', function() {window.location.hash = '#whotofollow';});
setTimeout(function (req) {req.trigger('click');}, 100, wtfRefresh);
//wtf.find('.view-all-users').on('click', function () {window.location.hash = '#whotofollow';});
}
}
@ -211,7 +211,7 @@ function initNewUsers() { @@ -211,7 +211,7 @@ function initNewUsers() {
if (nus.length) {
var nusRefresh = nus.find('.refresh-users');
nusRefresh.on('click', refreshNewUsers);
setTimeout(function() {nusRefresh.click();}, 100);
setTimeout(function (req) {req.trigger('click');}, 100, nusRefresh);
}
}
@ -234,7 +234,7 @@ function initTwistdayReminder() { @@ -234,7 +234,7 @@ function initTwistdayReminder() {
if ($module.length) {
var $moduleRefresh = $module.find('.refresh');
$moduleRefresh.on('click', refreshTwistdayReminder);
setTimeout(function() { $moduleRefresh.click() }, 100);
setTimeout(function (req) {req.trigger('click');}, 100, $moduleRefresh);
$module.find('.current').hide();
$module.find('.upcoming').hide();
}
@ -263,7 +263,7 @@ function refreshTwistdayReminder() { @@ -263,7 +263,7 @@ function refreshTwistdayReminder() {
item.find('.twister-user-name').attr('href', $.MAL.userUrl(lucky));
item.find('.twister-user-tag').text('@' + lucky);
itemTwisterday = item.find('.twisterday');
itemTwisterday.on('click', (function(e) {replyInitPopup(e, post);}).bind(post));
itemTwisterday.on('click', (function (e) {replyInitPopup(e, post);}).bind(post));
if (typeof time !== 'undefined')
itemTwisterday.text(timeGmtToText(time));
else
@ -431,4 +431,4 @@ function shortenMagnetLink(event,magnetLink) { @@ -431,4 +431,4 @@ function shortenMagnetLink(event,magnetLink) {
//******************* INIT **************
//***********************************************
var interfaceFunctions = new InterfaceFunctions;
$( document ).ready( interfaceFunctions.init );
$(interfaceFunctions.init);

4
js/interface_localization.js

@ -5628,8 +5628,8 @@ var fixedLabels = [ @@ -5628,8 +5628,8 @@ var fixedLabels = [
".ui-input-text"
];
$(document).ready(function(){
$(document).bind('pagecreate', function (){
$(function () {
$(document).on('pagecreate', function () {
var elems,content,i,e,LenElem,elem;
var LenLabels = fixedLabels.length;

4
js/interface_profile-edit.js

@ -15,7 +15,7 @@ function initProfileEdit() { @@ -15,7 +15,7 @@ function initProfileEdit() {
initInterfaceCommon();
$('.profile-card-photo.forEdition').on('click', function() { $('#avatar-file').click(); });
$('.profile-card-photo.forEdition').on('click', function () {$('#avatar-file').trigger('click');});
$('#avatar-file').on('change', handleAvatarFileSelect);
$('.submit-changes').on('click', saveProfile);
$('.cancel-changes').on('click', $.MAL.goHome);
@ -116,4 +116,4 @@ function localizePlaceholders() { @@ -116,4 +116,4 @@ function localizePlaceholders() {
$('.input-bitmessage').attr('placeholder', polyglot.t('Bitmessage address'));
}
$(document).ready(localizePlaceholders);
$(localizePlaceholders);

4
js/jQueryPlugins.js

@ -32,10 +32,10 @@ var n=m.attr("style");g.push(n);m.attr("style",n?n+";"+d:d);});};j=function(){c. @@ -32,10 +32,10 @@ var n=m.attr("style");g.push(n);m.attr("style",n?n+";"+d:d);});};j=function(){c.
jQuery.fn.clickoutside = function(callback) {
var outside = 1, self = $(this);
self.cb = callback;
this.click(function() {
this.on('click', function () {
outside = 0;
});
$(document).click(function() {
$(document).on('click', function () {
outside && self.cb();
outside = 1;
});

5
js/jquery-1.12.4.min.js vendored

File diff suppressed because one or more lines are too long

5
js/jquery-1.9.1.min.js vendored

File diff suppressed because one or more lines are too long

2
js/jquery-3.3.1.min.js vendored

File diff suppressed because one or more lines are too long

200
js/jquery.json-2.4.js

@ -1,200 +0,0 @@ @@ -1,200 +0,0 @@
/**
* jQuery JSON plugin 2.4.0
*
* @author Brantley Harris, 2009-2011
* @author Timo Tijhof, 2011-2012
* @source This plugin is heavily influenced by MochiKit's serializeJSON, which is
* copyrighted 2005 by Bob Ippolito.
* @source Brantley Harris wrote this plugin. It is based somewhat on the JSON.org
* website's http://www.json.org/json2.js, which proclaims:
* "NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.", a sentiment that
* I uphold.
* @license MIT License <http://www.opensource.org/licenses/mit-license.php>
*/
(function ($) {
'use strict';
var escape = /["\\\x00-\x1f]/g,
meta = {
'\b': '\\b',
'\t': '\\t',
'\n': '\\n',
'\f': '\\f',
'\r': '\\r',
'"' : '\\"',
'\\': '\\\\'
},
hasOwn = Object.prototype.hasOwnProperty;
/**
* jQuery.toJSON
* Converts the given argument into a JSON representation.
*
* @param o {Mixed} The json-serializable *thing* to be converted
*
* If an object has a toJSON prototype, that will be used to get the representation.
* Non-integer/string keys are skipped in the object, as are keys that point to a
* function.
*
*/
$.toJSON = typeof JSON === 'object' && JSON.stringify ? JSON.stringify : function (o) {
//$.toJSON = function (o) {
if (o === null) {
return 'null';
}
var pairs, k, name, val,
type = $.type(o);
if (type === 'undefined') {
return undefined;
}
// Also covers instantiated Number and Boolean objects,
// which are typeof 'object' but thanks to $.type, we
// catch them here. I don't know whether it is right
// or wrong that instantiated primitives are not
// exported to JSON as an {"object":..}.
// We choose this path because that's what the browsers did.
if (type === 'number' || type === 'boolean') {
return String(o);
}
if (type === 'string') {
return $.quoteString(o);
}
if (typeof o.toJSON === 'function') {
return $.toJSON(o.toJSON());
}
if (type === 'date') {
var month = o.getUTCMonth() + 1,
day = o.getUTCDate(),
year = o.getUTCFullYear(),
hours = o.getUTCHours(),
minutes = o.getUTCMinutes(),
seconds = o.getUTCSeconds(),
milli = o.getUTCMilliseconds();
if (month < 10) {
month = '0' + month;
}
if (day < 10) {
day = '0' + day;
}
if (hours < 10) {
hours = '0' + hours;
}
if (minutes < 10) {
minutes = '0' + minutes;
}
if (seconds < 10) {
seconds = '0' + seconds;
}
if (milli < 100) {
milli = '0' + milli;
}
if (milli < 10) {
milli = '0' + milli;
}
return '"' + year + '-' + month + '-' + day + 'T' +
hours + ':' + minutes + ':' + seconds +
'.' + milli + 'Z"';
}
pairs = [];
if ($.isArray(o)) {
for (k = 0; k < o.length; k++) {
pairs.push($.toJSON(o[k]) || 'null');
}
return '[' + pairs.join(',') + ']';
}
// Any other object (plain object, RegExp, ..)
// Need to do typeof instead of $.type, because we also
// want to catch non-plain objects.
if (typeof o === 'object') {
for (k in o) {
// Only include own properties,
// Filter out inherited prototypes
if (hasOwn.call(o, k)) {
// Keys must be numerical or string. Skip others
type = typeof k;
if (type === 'number') {
name = '"' + k + '"';
} else if (type === 'string') {
name = $.quoteString(k);
} else {
continue;
}
type = typeof o[k];
// Invalid values like these return undefined
// from toJSON, however those object members
// shouldn't be included in the JSON string at all.
if (type !== 'function' && type !== 'undefined') {
val = $.toJSON(o[k]);
pairs.push(name + ':' + val);
}
}
}
return '{' + pairs.join(',') + '}';
}
};
/**
* jQuery.evalJSON
* Evaluates a given json string.
*
* @param str {String}
*/
$.evalJSON = typeof JSON === 'object' && JSON.parse ? JSON.parse : function (str) {
/*jshint evil: true */
return eval('(' + str + ')');
};
/**
* jQuery.secureEvalJSON
* Evals JSON in a way that is *more* secure.
*
* @param str {String}
*/
$.secureEvalJSON = typeof JSON === 'object' && JSON.parse ? JSON.parse : function (str) {
var filtered =
str
.replace(/\\["\\\/bfnrtu]/g, '@')
.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
.replace(/(?:^|:|,)(?:\s*\[)+/g, '');
if (/^[\],:{}\s]*$/.test(filtered)) {
/*jshint evil: true */
return eval('(' + str + ')');
}
throw new SyntaxError('Error parsing JSON, source is not valid.');
};
/**
* jQuery.quoteString
* Returns a string-repr of a string, escaping quotes intelligently.
* Mostly a support function for toJSON.
* Examples:
* >>> jQuery.quoteString('apple')
* "apple"
*
* >>> jQuery.quoteString('"Where are we going?", she asked.')
* "\"Where are we going?\", she asked."
*/
$.quoteString = function (str) {
if (str.match(escape)) {
return '"' + str.replace(escape, function (a) {
var c = meta[a];
if (typeof c === 'string') {
return c;
}
c = a.charCodeAt();
return '\\u00' + Math.floor(c / 16).toString(16) + (c % 16).toString(16);
}) + '"';
}
return '"' + str + '"';
};
}(jQuery));

30
js/jquery.jsonrpcclient.js

@ -1,6 +1,5 @@ @@ -1,6 +1,5 @@
/**
* This plugin requires jquery.json.js to be available, or at least the methods $.toJSON and
* $.parseJSON.
* This plugin requires JSON to be available
*
* The plan is to make use of websockets if they are available, but work just as well with only
* http if not.
@ -84,29 +83,32 @@ @@ -84,29 +83,32 @@
throw "$.JsonRpcClient.call used with no websocket and no http endpoint.";
}
var options = this.options;
$.ajax({
type : 'POST',
url : this.options.ajaxUrl,
data : $.toJSON(request),
data : JSON.stringify(request),
dataType : 'json',
contentType: "application/json; charset=utf-8",
cache : false,
beforeSend: function (xhr) {
beforeSend: function (xhr) {
if( options.username != null && options.username != undefined ) {
xhr.setRequestHeader('Authorization', "Basic " + btoa(options.username + ":" + options.password));
}
},
success : function(data) {
if ('error' in data) error_cb(data.error);
success_cb(data.result);
if ('error' in data && data.error !== null) {
errorCb(data.error);
} else {
success_cb(data.result);
}
},
// JSON-RPC Server could return non-200 on error
error : function(jqXHR, textStatus, errorThrown) {
try {
var response = $.parseJSON(jqXHR.responseText);
var response = JSON.parse(jqXHR.responseText);
if ('console' in window) console.log(response);
error_cb(response.error);
}
@ -153,11 +155,11 @@ @@ -153,11 +155,11 @@
$.ajax({
type : 'POST',
url : this.options.ajaxUrl,
data : $.toJSON(request),
data : JSON.stringify(request),
dataType : 'json',
contentType: "application/json; charset=utf-8",
cache : false,
beforeSend: function (xhr){
beforeSend: function (xhr){
if( options.username != null && options.username != undefined ) {
xhr.setRequestHeader('Authorization', "Basic " + btoa(options.username + ":" + options.password));
}
@ -174,7 +176,7 @@ @@ -174,7 +176,7 @@
*
* @fn batch
* @memberof $.JsonRpcClient
*
*
* @param callback The main function which will get a batch handler to run call and notify on.
* @param all_done_cb A callback function to call after all results have been handled.
* @param error_cb A callback function to call if there is an error from the server.
@ -218,7 +220,7 @@ @@ -218,7 +220,7 @@
* @memberof $.JsonRpcClient
*/
$.JsonRpcClient.prototype._wsCall = function(socket, request, success_cb, error_cb) {
var request_json = $.toJSON(request);
var request_json = JSON.stringify(request);
if (socket.readyState < 1) {
// The websocket is not open yet; we have to set sending of the message in onopen.
@ -251,7 +253,7 @@ @@ -251,7 +253,7 @@
$.JsonRpcClient.prototype._wsOnMessage = function(event) {
// Check if this could be a JSON RPC message.
try {
var response = $.parseJSON(event.data);
var response = JSON.parse(event.data);
/// @todo Make using the jsonrcp 2.0 check optional, to use this on JSON-RPC 1 backends.
@ -395,7 +397,7 @@ @@ -395,7 +397,7 @@
// Send request
$.ajax({
url : self.jsonrpcclient.options.ajaxUrl,
data : $.toJSON(batch_request),
data : JSON.stringify(batch_request),
dataType : 'json',
contentType: "application/json; charset=utf-8",
cache : false,

5
js/jquery.min.js vendored

File diff suppressed because one or more lines are too long

4
js/jquery.textcomplete.min.js vendored

File diff suppressed because one or more lines are too long

24
js/mobile_abstract.js

@ -8,10 +8,10 @@ var MAL = function() @@ -8,10 +8,10 @@ var MAL = function()
{
this.postboardLoading = function() {
if( $.hasOwnProperty("mobile") ) {
$.mobile.showPageLoadingMsg();
$.mobile.loading('show');
/*
setTimeout(function(){
$.mobile.hidePageLoadingMsg();
$.mobile.loading('hide');
}, 10 * 1000);
*/
} else {
@ -21,7 +21,7 @@ var MAL = function() @@ -21,7 +21,7 @@ var MAL = function()
this.postboardLoaded = function() {
if( $.hasOwnProperty("mobile") ) {
$.mobile.hidePageLoadingMsg();
$.mobile.loading('hide');
var curPage = $.mobile.activePage.attr("id");
$( '#'+curPage+' .content ul.posts').listview('refresh');
@ -33,7 +33,7 @@ var MAL = function() @@ -33,7 +33,7 @@ var MAL = function()
this.commonDMsListLoaded = function () {
if ($.hasOwnProperty('mobile')) {
$.mobile.hidePageLoadingMsg();
$.mobile.loading('hide');
$('#directmsg .direct-messages-list').listview('refresh');
} else {
}
@ -41,7 +41,7 @@ var MAL = function() @@ -41,7 +41,7 @@ var MAL = function()
this.dmConversationLoaded = function (dmConvo) {
if ($.hasOwnProperty('mobile')) {
$.mobile.hidePageLoadingMsg();
$.mobile.loading('hide');
$('#dmchat .direct-messages-thread').listview('refresh');
$.mobile.silentScroll($('.dm-form').offset().top);
} else {
@ -52,7 +52,7 @@ var MAL = function() @@ -52,7 +52,7 @@ var MAL = function()
this.relatedPostLoaded = function() {
if( $.hasOwnProperty("mobile") ) {
$.mobile.hidePageLoadingMsg();
$.mobile.loading('hide');
var curPage = $.mobile.activePage.attr("id");
$( '#'+curPage+' .content ul.posts').listview('refresh');
} else {
@ -75,7 +75,7 @@ var MAL = function() @@ -75,7 +75,7 @@ var MAL = function()
this.listLoaded = function (list) {
if ($.hasOwnProperty('mobile')) {
$.mobile.hidePageLoadingMsg();
$.mobile.loading('hide');
list.listview('refresh');
} else
list.find('.loading-roller').hide();
@ -83,7 +83,7 @@ var MAL = function() @@ -83,7 +83,7 @@ var MAL = function()
this.searchUserListLoaded = function() {
if( $.hasOwnProperty("mobile") ) {
$.mobile.hidePageLoadingMsg();
$.mobile.loading('hide');
$(".userMenu-search-profiles").listview('refresh');
} else {
var $searchResultsModal = $( ".search-results" );
@ -405,7 +405,7 @@ var MAL = function() @@ -405,7 +405,7 @@ var MAL = function()
$button.button("enable");
} else {
$button.removeClass("disabled");
$button.removeAttr("disabled");
$button.prop('disabled', false);
}
}
@ -414,7 +414,7 @@ var MAL = function() @@ -414,7 +414,7 @@ var MAL = function()
$button.button("disable");
} else {
$button.addClass("disabled");
$button.attr("disabled","true");
$button.prop('disabled', true);
}
}
@ -440,11 +440,11 @@ var MAL = function() @@ -440,11 +440,11 @@ var MAL = function()
removeClose: true
});
modal.content.find('.confirm').attr('disabled', true);
modal.content.find('.confirm').prop('disabled', true);
sendNewUserTransaction(peerAlias,
function (accountCreatedModal) {
accountCreatedModal.content.find('.confirm').attr('disabled', false);
accountCreatedModal.content.find('.confirm').prop('disabled', false);
}, modal
);
}

2
js/options.js

@ -199,7 +199,7 @@ function twisterOptions() { @@ -199,7 +199,7 @@ function twisterOptions() {
name: 'useProxy',
valDefault: 'disable',
tickMethod: function (elem) {
$('#useProxyForImgOnly').attr('disabled', (elem.value === 'disable') ? true : false);
$('#useProxyForImgOnly').prop('disabled', elem.value === 'disable');
}
});
this.add({

82
js/tmobile.js

@ -11,13 +11,13 @@ function initializeTwister( redirectNetwork, redirectLogin, cbFunc, cbArg ) { @@ -11,13 +11,13 @@ function initializeTwister( redirectNetwork, redirectLogin, cbFunc, cbArg ) {
installUserSearchHandler();
installProfileEditHandlers();
// install scrollbottom handler to load more posts as needed
$(window).scroll(function(){
$(window).on('scroll', function () {
if ($(window).scrollTop() >= $(document).height() - $(window).height() - 20){
reachedScrollBottom();
}
});
// home screen timeline refresh button
$( ".timeline-refresh").click(function(e) {
$('.timeline-refresh').on('click', function (e) {
$.MAL.setPostTemplate( $("#post-template-home") );
requestTimelineUpdate("latest",postsPerRefresh,followingUsers);
$.mobile.silentScroll(0);
@ -90,16 +90,16 @@ var router=new $.mobile.Router( @@ -90,16 +90,16 @@ var router=new $.mobile.Router(
{ "#new-user-modal": {handler: "newusermodal", events: "bs" } },
],{
index: function(type,match,ui) {
$.mobile.showPageLoadingMsg();
$.mobile.loading('show');
initializeTwister( true, true, function() {
//$.MAL.goHome();
});
},
home: function(type,match,ui) {
$.mobile.showPageLoadingMsg();
$.mobile.loading('show');
initializeTwister( true, true, function() {
if( !$("#home .posts").children().length ) {
$.mobile.showPageLoadingMsg();
$.mobile.loading('show');
cleanupStorage();
getFullname( defaultScreenName, $("#home .rtitle"));
$(".mentions-count").attr("href","#mentions?user="+defaultScreenName );
@ -111,7 +111,7 @@ var router=new $.mobile.Router( @@ -111,7 +111,7 @@ var router=new $.mobile.Router(
profile: function(type,match,ui) {
var params=router.getParams(match[1]);
clearProfilePage();
$.mobile.showPageLoadingMsg();
$.mobile.loading('show');
initializeTwister( true, true, function() {
var user;
if( params && params.hasOwnProperty("user") ) {
@ -126,13 +126,13 @@ var router=new $.mobile.Router( @@ -126,13 +126,13 @@ var router=new $.mobile.Router(
$newmsgLink.hide();
}
$.mobile.showPageLoadingMsg();
$.mobile.loading('show');
$.MAL.setPostTemplate( $("#post-template-home") );
updateProfileData( $("#profile"), user);
});
},
profileedit: function(type,match,ui) {
$.mobile.showPageLoadingMsg();
$.mobile.loading('show');
initializeTwister( true, true, function() {
loadAvatarForEdit();
loadProfileForEdit();
@ -144,7 +144,7 @@ var router=new $.mobile.Router( @@ -144,7 +144,7 @@ var router=new $.mobile.Router(
following: function(type,match,ui) {
var params=router.getParams(match[1]);
clearProfilePage();
$.mobile.showPageLoadingMsg();
$.mobile.loading('show');
initializeTwister( true, true, function() {
var user;
if( params && params.hasOwnProperty("user") ) {
@ -158,7 +158,7 @@ var router=new $.mobile.Router( @@ -158,7 +158,7 @@ var router=new $.mobile.Router(
if( params && params.hasOwnProperty("unfollow") ) {
unfollow(params.unfollow);
}
$.mobile.showPageLoadingMsg();
$.mobile.loading('show');
$("#following a.ui-btn").removeClass("ui-btn-active");
var followingList = twister.tmpl.followingList.clone(true).appendTo($("#following .content"))
.closest('.following-list').listview();
@ -172,7 +172,7 @@ var router=new $.mobile.Router( @@ -172,7 +172,7 @@ var router=new $.mobile.Router(
var $ulPost = $("#post ul.posts");
$ulPost.text("");
$.MAL.setPostTemplate( $("#post-template-post") );
var originalLi = postToElem($.evalJSON(params.userpost), "original");
var originalLi = postToElem(JSON.parse(params.userpost), 'original');
$ulPost.append(originalLi);
$ulPost.find(".post-interactions").trigger('create');
$ulPost.listview('refresh');
@ -202,7 +202,7 @@ var router=new $.mobile.Router( @@ -202,7 +202,7 @@ var router=new $.mobile.Router(
$replyOriginal.html("");
if( params && params.hasOwnProperty("userpost") ) {
$.MAL.setPostTemplate( $("#post-template-home") );
var originalLi = postToElem($.evalJSON(params.userpost), "original");
var originalLi = postToElem(JSON.parse(params.userpost), 'original');
$replyOriginal.append(originalLi);
$replyOriginal.listview('refresh');
}
@ -216,7 +216,7 @@ var router=new $.mobile.Router( @@ -216,7 +216,7 @@ var router=new $.mobile.Router(
var $rtOriginal = $(".rt-original-post")
$rtOriginal.html("");
$.MAL.setPostTemplate( $("#post-template-home") );
var originalLi = postToElem($.evalJSON(params.userpost), "original");
var originalLi = postToElem(JSON.parse(params.userpost), 'original');
$rtOriginal.append(originalLi);
$rtOriginal.listview('refresh');
@ -225,7 +225,7 @@ var router=new $.mobile.Router( @@ -225,7 +225,7 @@ var router=new $.mobile.Router(
},
mentions: function(type,match,ui) {
var params=router.getParams(match[1]);
$.mobile.showPageLoadingMsg();
$.mobile.loading('show');
initializeTwister( true, true, function() {
var user;
var $newmsgLink = $("a.mention-newmsg");
@ -244,7 +244,7 @@ var router=new $.mobile.Router( @@ -244,7 +244,7 @@ var router=new $.mobile.Router(
},
hashtag: function(type,match,ui) {
var params=router.getParams(match[1]);
$.mobile.showPageLoadingMsg();
$.mobile.loading('show');
initializeTwister( true, true, function() {
$("#hashtag .rtitle").text("#" + params.hashtag);
$("a.hashtag-newmsg").attr("href",$.MAL.newPostHashtagToUrl(params.hashtag));
@ -255,31 +255,31 @@ var router=new $.mobile.Router( @@ -255,31 +255,31 @@ var router=new $.mobile.Router(
login: function(type,match,ui) {
if (!$('#login .content').children().length)
$('#login .content').append(twister.tmpl.loginMC.clone(true)).trigger('create');
$.mobile.showPageLoadingMsg();
$.mobile.loading('show');
initializeTwister( true, false, function() {
$.mobile.hidePageLoadingMsg();
$.mobile.loading('hide');
$("select.local-usernames").selectmenu("refresh", true);
});
},
network: function(type,match,ui) {
$.mobile.showPageLoadingMsg();
$.mobile.loading('show');
initializeTwister( false, false, function() {
$.mobile.hidePageLoadingMsg();
$.mobile.loading('hide');
$("select.local-usernames.spam-user").selectmenu("refresh", true);
getSpamMsg();
getGenerate();
});
},
directmsg: function(type,match,ui) {
$.mobile.showPageLoadingMsg();
$.mobile.loading('show');
initializeTwister( true, true, function() {
$.mobile.showPageLoadingMsg();
$.mobile.loading('show');
modalDMsSummaryDraw($('#directmsg .direct-messages-list'));
});
},
dmchat: function(type,match,ui) {
var params=router.getParams(match[1]);
$.mobile.showPageLoadingMsg();
$.mobile.loading('show');
initializeTwister( true, true, function() {
var peerAlias = params.user;
var board = $('#dmchat .direct-messages-thread').empty();
@ -288,7 +288,7 @@ var router=new $.mobile.Router( @@ -288,7 +288,7 @@ var router=new $.mobile.Router(
$("#dmchat textarea").val("");
installDMSendClick(peerAlias);
$.mobile.showPageLoadingMsg();
$.mobile.loading('show');
tmobileQueryReq = queryStart(board, peerAlias, 'direct', undefined, 2000, {
boardAutoAppend: true,
@ -333,29 +333,29 @@ var router=new $.mobile.Router( @@ -333,29 +333,29 @@ var router=new $.mobile.Router(
function installPostboardClick() {
var $postDatas = $(".post-data");
$postDatas.unbind('click').click(function(e){
$postDatas.off('click').on('click', function (e) {
e.stopPropagation();
e.preventDefault();
var userpost = $(this).attr("data-userpost");
var url = "#post?userpost=" + encodeURIComponent(userpost);
$.mobile.showPageLoadingMsg();
$.mobile.loading('show');
$.mobile.navigate( url );
});
$(".post a").unbind('click').click(function(e) {
$(".post a").off('click').on('click', function (e) {
e.stopPropagation();
// stopPropagation is supposed to be enough, but in Android the
// default action is not called so we reimplement it here as a hack.
e.preventDefault();
$.mobile.showPageLoadingMsg();
$.mobile.loading('show');
$.mobile.navigate( $(this).attr("href") );
});
}
function installReplyClick() {
var $postReply = $("#post .post-reply");
$postReply.unbind('click').click(function(e){
$postReply.off('click').on('click', function (e) {
e.stopPropagation();
e.preventDefault();
@ -364,21 +364,21 @@ function installReplyClick() { @@ -364,21 +364,21 @@ function installReplyClick() {
var replyTo = $postData.attr("data-reply-to");
var url = "#newmsg?replyto=" + encodeURIComponent(replyTo) +
"&userpost=" + encodeURIComponent(userpost);
$.mobile.showPageLoadingMsg();
$.mobile.loading('show');
$.mobile.navigate( url );
});
}
function installRetransmitClick() {
var $postRt = $("#post .post-propagate");
$postRt.unbind('click').click(function(e){
$postRt.off('click').on('click', function (e) {
e.stopPropagation();
e.preventDefault();
var $postData = $(this).closest(".post-data");
var userpost = $postData.attr("data-userpost");
var url = "#rt?userpost=" + encodeURIComponent(userpost);
$.mobile.showPageLoadingMsg();
$.mobile.loading('show');
$.mobile.navigate( url );
});
}
@ -386,7 +386,7 @@ function installRetransmitClick() { @@ -386,7 +386,7 @@ function installRetransmitClick() {
function installSubmitClick() {
var $postSubmit = $(".post-submit");
$postSubmit.unbind('click').click(function(e){
$postSubmit.off('click').on('click', function (e) {
e.stopPropagation();
e.preventDefault();
@ -422,13 +422,13 @@ function installDMSendClick(peerAlias) { @@ -422,13 +422,13 @@ function installDMSendClick(peerAlias) {
function installRetransmitConfirmClick() {
var $postConfirmRt = $(".retransmit-confirm");
$postConfirmRt.unbind('click').click(function(e){
$postConfirmRt.off('click').on('click', function (e) {
e.stopPropagation();
e.preventDefault();
var $postOrig = $("#rt .rt-original-post .post-data");
$.mobile.showPageLoadingMsg();
$.mobile.loading('show');
newRtMsg($postOrig);
$.MAL.goHome();
});
@ -445,13 +445,13 @@ function installUserSearchHandler() { @@ -445,13 +445,13 @@ function installUserSearchHandler() {
}
function installProfileEditHandlers() {
$(".profile-card-photo.forEdition").click( function() { $('#avatar-file').click(); } );
$("#avatar-file").bind( "change", handleAvatarFileSelectMobile);
$(".submit-changes").click( function() {
$('.profile-card-photo.forEdition').on('click', function () {$('#avatar-file').trigger('click');});
$('#avatar-file').on('change', handleAvatarFileSelectMobile);
$('.submit-changes').on('click', function () {
saveProfile();
setTimeout( function() {$.MAL.goHome();}, 1000);
} );
$(".cancel-changes").click( $.mobile.back );
$('.cancel-changes').on('click', $.mobile.back);
}
function handleAvatarFileSelectMobile(evt) {
@ -501,7 +501,7 @@ function handleClickOpenConversation(event) { @@ -501,7 +501,7 @@ function handleClickOpenConversation(event) {
var userpost = $(event.target).closest(event.data.feeder).attr('data-userpost');
$.mobile.showPageLoadingMsg();
$.mobile.loading('show');
$.mobile.navigate('#post?userpost=' + encodeURIComponent(userpost));
}
@ -545,7 +545,7 @@ var tmobileQueryReq; @@ -545,7 +545,7 @@ var tmobileQueryReq;
function setupHashtagOrMention(board, query, resource) {
$.MAL.setPostTemplate( $("#post-template-home") );
$.mobile.showPageLoadingMsg();
$.mobile.loading('show');
board.empty();
tmobileQueryReq = queryStart(board, query, resource, undefined, undefined, {
@ -578,7 +578,7 @@ function tmobileTick() { @@ -578,7 +578,7 @@ function tmobileTick() {
}
}
$(document).bind('mobileinit', function () {
$(document).on('mobileinit', function () {
$.mobile.allowCrossDomainPages = true;
$.mobile.zoom.enabled = false;
$.mobile.buttonMarkup.hoverDelay = 0; //defaults 200

12
js/twister_actions.js

@ -102,7 +102,7 @@ function getTopPostOfConversation(postLi, post, postboard) { @@ -102,7 +102,7 @@ function getTopPostOfConversation(postLi, post, postboard) {
}
requestRepliesAfterAll(newStreamPost);
newStreamPost.find('.post-expand').remove();
newStreamPost.unbind('click');
newStreamPost.off('click');
newStreamPost.hide();
postboard.append(newStreamPost);
newStreamPost.slideDown("fast");
@ -287,7 +287,7 @@ function requestPostRecursively(containerToAppend,username,resource,count,useGet @@ -287,7 +287,7 @@ function requestPostRecursively(containerToAppend,username,resource,count,useGet
requestPostRecursively(args.containerToAppend, n, "post"+lastk, count-1);
} else {
profilePostsLoading = false;
args.containerToAppend.scroll();
args.containerToAppend.trigger('scroll');
}
} else {
profilePostsLoading = false;
@ -413,7 +413,7 @@ function newRtMsg(userpost, sig_userpost, comment, cbFunc, cbReq) { @@ -413,7 +413,7 @@ function newRtMsg(userpost, sig_userpost, comment, cbFunc, cbReq) {
}
function newFavMsg(postData, priv, msg) {
var userpost = $.evalJSON(postData.attr('data-content_to_rt'));
var userpost = JSON.parse(postData.attr('data-content_to_rt'));
var sig_userpost = postData.attr('data-content_to_sigrt');
if (!sig_userpost) {
@ -523,7 +523,7 @@ function updateProfileData(profileModalContent, username) { @@ -523,7 +523,7 @@ function updateProfileData(profileModalContent, username) {
function updateProfilePosts(postsView, username, useGetposts) {
requestPostRecursively(postsView,username,"status",postsPerRefresh, useGetposts);
postsView.scroll(function(){
postsView.on('scroll', function () {
if (!profilePostsLoading) {
var $this = $(this);
if ($this.scrollTop() >= this.scrollHeight - $this.height() - 20) {
@ -686,7 +686,7 @@ function queryProcess(req, res) { @@ -686,7 +686,7 @@ function queryProcess(req, res) {
if (!twister.res[this.req].board || !focusModalWithElement(twister.res[this.req].board,
function (req) {
twister.res[req].board.closest('.postboard')
.find('.postboard-news').click();
.find('.postboard-news').trigger('click');
},
this.req
))
@ -770,7 +770,7 @@ function queryProcess(req, res) { @@ -770,7 +770,7 @@ function queryProcess(req, res) {
focusModalWithElement(twister.res[this.req].board,
function (req) {
twister.res[req].board.closest('.postboard')
.find('.postboard-news').click();
.find('.postboard-news').trigger('click');
},
this.req
);

8
js/twister_directmsg.js

@ -125,7 +125,7 @@ function openDmWithUserModal(peerAlias) { @@ -125,7 +125,7 @@ function openDmWithUserModal(peerAlias) {
$('.dm-form-template').children().clone(true)
.addClass('open').appendTo(modal.content).fadeIn('fast')
.find('textarea').focus();
.find('textarea').trigger('focus');
}
function openGroupMessagesModal(groupAlias) {
@ -193,7 +193,7 @@ function openGroupMessagesModal(groupAlias) { @@ -193,7 +193,7 @@ function openGroupMessagesModal(groupAlias) {
$('.dm-form-template').children().clone(true)
.addClass('open').appendTo(req.modal.content).fadeIn('fast')
.find('textarea').focus();
.find('textarea').trigger('focus');
}
}, {groupAlias: groupAlias, modal: modal}
);
@ -259,7 +259,7 @@ function openGroupMessagesJoinGroupModal() { @@ -259,7 +259,7 @@ function openGroupMessagesJoinGroupModal() {
.on('click', function (event) {
var elemEvent = $(event.target);
elemEvent.closest('.module').find('.join')
.attr('disabled',
.prop('disabled',
!elemEvent.closest('.groups-list').find('input:checked').length);
})
;
@ -442,7 +442,7 @@ function initInterfaceDirectMsg() { @@ -442,7 +442,7 @@ function initInterfaceDirectMsg() {
$('.userMenu-groupmessages a').attr('href', '#groupmessages');
$('.dm-submit').on('click', directMsgSubmit);
$('.direct-messages-with-user').on('click', function() {
$('.direct-messages-with-user').on('click', function () {
window.location.hash = '#directmessages?user=' +
$(this).closest('[data-screen-name]').attr('data-screen-name');
});

12
js/twister_formatpost.js

@ -7,7 +7,7 @@ var _htmlFormatMsgLinkTemplateExternal; @@ -7,7 +7,7 @@ var _htmlFormatMsgLinkTemplateExternal;
var _htmlFormatMsgLinkTemplateUser;
var _htmlFormatMsgLinkTemplateHashtag;
$(document).ready(function() {
$(function () {
// we're setting it here for perfomance improvement purpose
// to not search and prepare it for for every post every time
_htmlFormatMsgLinkTemplateExternal = $('#external-page-link-template')
@ -73,14 +73,14 @@ function postToElem(post, kind, promoted) { @@ -73,14 +73,14 @@ function postToElem(post, kind, promoted) {
k = userpost.k;
time = userpost.time;
msg = userpost.msg + (userpost.msg2 || '');
content_to_rt = $.toJSON(userpost);
content_to_rt = JSON.stringify(userpost);
content_to_sigrt = post.sig_userpost;
} else {
username = rt.n;
k = rt.k;
time = rt.time;
msg = rt.msg + (rt.msg2 || '');
content_to_rt = $.toJSON(rt);
content_to_rt = JSON.stringify(rt);
content_to_sigrt = userpost.sig_rt;
}
retweeted_by = userpost.n;
@ -89,7 +89,7 @@ function postToElem(post, kind, promoted) { @@ -89,7 +89,7 @@ function postToElem(post, kind, promoted) {
k = userpost.k;
time = userpost.time;
msg = userpost.msg + (userpost.msg2 || '');
content_to_rt = $.toJSON(userpost);
content_to_rt = JSON.stringify(userpost);
content_to_sigrt = post.sig_userpost;
}
if (typeof msg !== 'string')
@ -111,7 +111,7 @@ function postToElem(post, kind, promoted) { @@ -111,7 +111,7 @@ function postToElem(post, kind, promoted) {
var postData = elem.find('.post-data');
postData.addClass(kind)
.attr('data-userpost', $.toJSON(post))
.attr('data-userpost', JSON.stringify(post))
.attr('data-content_to_rt', content_to_rt)
.attr('data-content_to_sigrt', content_to_sigrt)
.attr('data-screen-name', username)
@ -246,7 +246,7 @@ function setPostReference(elem, rt, sig_rt) { @@ -246,7 +246,7 @@ function setPostReference(elem, rt, sig_rt) {
.find('.post-rt-reference')
.attr('data-screen-name', rt.n)
.attr('data-id', rt.k)
.attr('data-userpost', $.toJSON({userpost: rt, sig_userpost: sig_rt}))
.attr('data-userpost', JSON.stringify({userpost: rt, sig_userpost: sig_rt}))
.find('.post-text').each(function (i, elem) {fillElemWithTxt($(elem), rt.msg + (rt.msg2 || ''));})
;
setPostCommon(elem, rt.n, rt.time);

2
js/twister_io.js

@ -13,7 +13,7 @@ function twisterRpc(method, params, resultFunc, resultArg, errorFunc, errorArg) @@ -13,7 +13,7 @@ function twisterRpc(method, params, resultFunc, resultArg, errorFunc, errorArg)
var foo = new $.JsonRpcClient({ajaxUrl: window.location.pathname.replace(/[^\/]*$/, '')});
foo.call(method, params,
function(ret) {resultFunc(resultArg, ret);},
function(ret) {if (ret != null) errorFunc(errorArg, ret);} // FIXME why only if "(ret != null)"?
function(ret) {errorFunc(errorArg, ret);} // FIXME why only if "(ret != null)"?
);
}

13
js/twister_network.js

@ -286,7 +286,6 @@ function setSpamMsg(event) { @@ -286,7 +286,6 @@ function setSpamMsg(event) {
function exitDaemon() {
$( ".terminate-daemon").text("Exiting...");
$( ".terminate-daemon").addClass("disabled");
$.MAL.disableButton( $( ".terminate-daemon") );
twisterRpc("stop", undefined,
@ -304,12 +303,12 @@ function exitDaemon() { @@ -304,12 +303,12 @@ function exitDaemon() {
// handlers common to both desktop and mobile
function interfaceNetworkHandlers() {
$( ".new-peer-addr" ).keyup( peerKeypress );
$( ".new-dns-addr" ).keyup( dnsKeypress );
$( ".add-peer").bind( "click", addPeerClick );
$( ".add-dns").bind( "click", addDNSClick );
$( "select.genblock").change( setGenerate );
$( ".genproclimit").change( setGenerate );
$('.new-peer-addr').on('keyup', peerKeypress);
$('.new-dns-addr').on('keyup', dnsKeypress);
$('.add-peer').on('click', addPeerClick);
$('.add-dns').on('click', addDNSClick);
$('select.genblock').on('change', setGenerate);
$('.genproclimit').on('change', setGenerate);
$('.network .post-area-new').off('click').on('click',
function (e) {e.stopPropagation(); $(this).addClass('open'); usePostSpliting = false;});
$('.post-submit.update-spam-msg').off('click').on('click', setSpamMsg);

3
network.html

@ -4,9 +4,8 @@ @@ -4,9 +4,8 @@
<meta charset="utf-8"/>
<title>Network status</title>
<link id="stylecss" rel="stylesheet" href="css/style.css" type="text/css"/>
<script src="js/jquery.min.js"></script>
<script src="js/jquery-3.3.1.min.js"></script>
<script src="js/jQueryPlugins.js"></script>
<script src="js/jquery.json-2.4.js"></script>
<script src="js/jquery.jsonrpcclient.js"></script>
<script src="js/jquery.storageapi.js"></script>
<script src="js/options.js"></script>

3
options.html

@ -4,9 +4,8 @@ @@ -4,9 +4,8 @@
<meta charset="utf-8"/>
<title>Options</title>
<link id="stylecss" rel="stylesheet" href="css/style.css" type="text/css"/>
<script src="js/jquery.min.js"></script>
<script src="js/jquery-3.3.1.min.js"></script>
<script src="js/jQueryPlugins.js"></script>
<script src="js/jquery.json-2.4.js"></script>
<script src="js/jquery.jsonrpcclient.js"></script>
<script src="js/jquery.storageapi.js"></script>
<script src="js/options.js"></script>

3
profile-edit.html

@ -4,9 +4,8 @@ @@ -4,9 +4,8 @@
<title>Edit profile</title>
<link id="stylecss" rel="stylesheet" href="css/style.css" type="text/css">
<link id="profilecss" rel="stylesheet" href="css/profile.css" type="text/css">
<script src="js/jquery.min.js"></script>
<script src="js/jquery-3.3.1.min.js"></script>
<script src="js/jQueryPlugins.js"></script>
<script src="js/jquery.json-2.4.js"></script>
<script src="js/jquery.jsonrpcclient.js"></script>
<script src="js/jquery.storageapi.js"></script>
<script src="js/options.js"></script>

12
theme_nin/js/theme_option.js

@ -1,5 +1,4 @@ @@ -1,5 +1,4 @@
$(function(){
$(function () {
$('.modal-close').html('');
$('.modal-back').html('');
$('.twister-user-remove').html('');
@ -10,13 +9,12 @@ $(function(){ @@ -10,13 +9,12 @@ $(function(){
$.globalEval(postToElem.toString().replace(/postContext.append\(twister\.tmpl\.postRtBy/,
'postContext.prependTo(postContext.parent()).append(twister.tmpl.postRtBy'));
$( '.userMenu-home.current a' ).on( 'click', function() {
$('.userMenu-home.current a').on('click', function () {
$('html, body').animate({scrollTop:0},300);
return false
});
$( ".promoted-posts-only").click(function() {
$('.promoted-posts-only').on('click', function () {
// modify the way promoted posts are shown
//active promoted posts tab
$(this).children('.promoted-posts').addClass(promotedPostsOnly ? "active" : "disabled");
@ -28,7 +26,7 @@ $(function(){ @@ -28,7 +26,7 @@ $(function(){
$('#postboard-top').addClass(promotedPostsOnly ? "hide" : "show");
});
$(window).scroll((function(){
$(window).on('scroll', (function () {
if ($(document).scrollTop() >= 250) {
if (this.css('display') === 'none')
this.slideDown(300);
@ -49,7 +47,7 @@ $(function(){ @@ -49,7 +47,7 @@ $(function(){
;
if (/\/options.html$/i.test(document.location))
$(document).ready(localizeLabels);
localizeLabels();
});
function localizeLabels() {

3
tmobile.html

@ -10,12 +10,11 @@ @@ -10,12 +10,11 @@
<meta name="viewport" content="width=device-width, user-scalable=no"/>
<link rel="stylesheet" href="css/jquery.mobile-1.3.2.min.css" />
<script src="js/jquery-1.9.1.min.js"></script>
<script src="js/jquery-1.12.4.min.js"></script>
<script src="js/jquery.mobile.router.min.js"></script>
<script src="js/jquery.mobile-1.3.2.min.js"></script>
<script src="js/jQueryPlugins.js"></script>
<script src="js/jquery.json-2.4.js"></script>
<script src="js/jquery.jsonrpcclient.js"></script>
<script src="js/jquery.storageapi.js"></script>
<script src="js/options.js?vr=10"></script>

Loading…
Cancel
Save