Browse Source

merge more calm code into interface_common.js so we may remove dependency on calm.js

master
Miguel Freitas 11 years ago
parent
commit
bcc51d9613
  1. 1
      following.html
  2. 1
      home.html
  3. 65
      js/calm.js
  4. 60
      js/interface_common.js
  5. 1
      login.html
  6. 1
      network.html
  7. 1
      options.html
  8. 1
      profile-edit.html

1
following.html

@ -23,7 +23,6 @@ @@ -23,7 +23,6 @@
<script src="js/twister_directmsg.js"></script>
<script src="js/twister_actions.js"></script>
<script src="js/interface_common.js"></script>
<script src="js/calm.js"></script>
<script>
$(document).ready(function()

1
home.html

@ -26,7 +26,6 @@ @@ -26,7 +26,6 @@
<script src="js/interface_common.js"></script>
<script src="js/interface_home.js"></script>
<script src="js/jquery.textcomplete.js"></script>
<script src="js/calm.js"></script>
<script>
$(function(){setTimeout(mensAutocomplete, 800);})
changeStyle();

65
js/calm.js

@ -1,11 +1,4 @@ @@ -1,11 +1,4 @@
$(function(){
$('.dropdown-menu').on('keydown', function(e){
e = event || window.event;
e.stopPropagation();
})
$('.post-text').on('click', 'a', function(e){
e.stopPropagation();
});
$('#showqr').on('click', function(){
if($('#qrcode img')[0]) return;
var skey = document.getElementById('skey').innerText;
@ -36,65 +29,7 @@ $(function(){ @@ -36,65 +29,7 @@ $(function(){
setTimeout(dhtIndicatorBg, 300);
setTimeout(function() {setInterval(dhtIndicatorBg, 2000)}, 400);
function modalDMIntr() {
$(".cancel").on('click', function(event){
if(!$(event.target).hasClass("cancel")) return;
if($(".modal-content").attr("style") != undefined){$(".modal-content").removeAttr("style")};
$('.modal-back').css('display', 'none');
});
$('.modal-back').on('click', function(){
if($('.modal-content .direct-messages-list')[0]) return;
directMessagesPopup();
$(".modal-content").removeAttr("style");
});
};
function mensAutocomplete() {
var suggests = [];
for(var i = 0; i < followingUsers.length; i++){
if(followingUsers[i] == localStorage.defaultScreenName) continue;
suggests.push(followingUsers[i]);
}
suggests.reverse();
$('textarea').textcomplete([
{ // html
mentions: suggests,
match: /\B@(\w*)$/,
search: function (term, callback) {
callback($.map(this.mentions, function (mention) {
return mention.indexOf(term) === 0 ? mention : null;
}));
},
index: 1,
replace: function (mention) {
return '@' + mention + ' ';
}
}
])
}
function changeStyle() {
var style, profile, menu;
var theme = $.Options.getTheme();
if(theme == 'original')
{
style = 'css/style.css';
profile = 'css/profile.css';
menu = '.original_menu';
$(".userMenu-dhtindicator").hide();
}else
{
style = 'theme_calm/css/style.css';
profile = 'theme_calm/css/profile.css';
menu = '.calm_menu';
}
$('#stylecss').attr('href', style);
$('#profilecss').attr('href', profile);
setTimeout(function(){$(menu).removeAttr('style')}, 0);
}
function homeIntInit () {
modalDMIntr ();
setTimeout(mensAutocomplete, 800);
}

60
js/interface_common.js

@ -974,12 +974,72 @@ var retweetSubmit = function(e) @@ -974,12 +974,72 @@ var retweetSubmit = function(e)
closeModal($this);
}
function changeStyle() {
var style, profile, menu;
var theme = $.Options.getTheme();
if(theme == 'original')
{
style = 'css/style.css';
profile = 'css/profile.css';
menu = '.original_menu';
$(".userMenu-dhtindicator").hide();
}else
{
style = 'theme_calm/css/style.css';
profile = 'theme_calm/css/profile.css';
menu = '.calm_menu';
}
$('#stylecss').attr('href', style);
$('#profilecss').attr('href', profile);
setTimeout(function(){$(menu).removeAttr('style')}, 0);
}
function mensAutocomplete() {
var suggests = [];
for(var i = 0; i < followingUsers.length; i++){
if(followingUsers[i] == localStorage.defaultScreenName) continue;
suggests.push(followingUsers[i]);
}
suggests.reverse();
$('textarea').textcomplete([
{ // html
mentions: suggests,
match: /\B@(\w*)$/,
search: function (term, callback) {
callback($.map(this.mentions, function (mention) {
return mention.indexOf(term) === 0 ? mention : null;
}));
},
index: 1,
replace: function (mention) {
return '@' + mention + ' ';
}
}
])
}
function initInterfaceCommon() {
$( "body" ).on( "click", function(event) {
if($(event.target).hasClass('cancel')) closeModal($(this));
});
$(".cancel").on('click', function(event){
if(!$(event.target).hasClass("cancel")) return;
if($(".modal-content").attr("style") != undefined){$(".modal-content").removeAttr("style")};
$('.modal-back').css('display', 'none');
});
$('.modal-back').on('click', function(){
if($('.modal-content .direct-messages-list')[0]) return;
directMessagesPopup();
$(".modal-content").removeAttr("style");
});
$('.dropdown-menu').on('keydown', function(e){
e = event || window.event;
e.stopPropagation();
})
$('.post-text').on('click', 'a', function(e){
e.stopPropagation();
});
$( ".post-reply" ).bind( "click", postReplyClick );
$( ".post-propagate" ).bind( "click", reTwistPopup );
$( ".userMenu-config-dropdown" ).bind( "click", dropDownMenu );

1
login.html

@ -18,7 +18,6 @@ @@ -18,7 +18,6 @@
<script src="js/interface_login.js"></script>
<script src="js/polyglot.min.js"></script>
<script src="js/interface_localization.js"></script>
<script src="js/calm.js"></script>
<script>
$(document).ready(function()

1
network.html

@ -20,7 +20,6 @@ @@ -20,7 +20,6 @@
<script src="js/interface_localization.js"></script>
<script src="js/twister_network.js"></script>
<script src="js/interface_common.js"></script>
<script src="js/calm.js"></script>
<script>
$(document).ready(function()

1
options.html

@ -18,7 +18,6 @@ @@ -18,7 +18,6 @@
<script src="js/interface_login.js"></script>
<script src="js/polyglot.min.js"></script>
<script src="js/interface_localization.js"></script>
<script src="js/calm.js"></script>
<script>$(function(){
initInterfaceCommon();
$.Options.InitOptions();})

1
profile-edit.html

@ -20,7 +20,6 @@ @@ -20,7 +20,6 @@
<script src="js/twister_newmsgs.js"></script>
<script src="js/interface_common.js"></script>
<script src="js/interface_profile-edit.js"></script>
<script src="js/calm.js"></script>
<script>
$(document).ready(function()

Loading…
Cancel
Save