Skip to content

Commit

Permalink
Fixes #35, fixes #36
Browse files Browse the repository at this point in the history
  • Loading branch information
BrunoSpy committed Oct 14, 2016
1 parent a19868c commit 173c810
Showing 1 changed file with 43 additions and 8 deletions.
51 changes: 43 additions & 8 deletions js/olcc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ var GlobalPinni = null;
var GlobalProcessing = false;
var GlobalWindowFocus = true;
var GlobalFilters = new Array();
var GlobalOnTouch = false;

var norloge_exp = new RegExp("((?:1[0-2]|0[1-9])/(?:3[0-1]|[1-2][0-9]|0[1-9])#)?((?:2[0-3]|[0-1][0-9])):([0-5][0-9])(:[0-5][0-9])?([¹²³]|[:\^][1-9]|[:\^][1-9][0-9])?(@[A-Za-z0-9_]+)?", "");

Expand Down Expand Up @@ -685,12 +686,16 @@ $(document).ready(function(){
jqxhr
.success(function(){
$("#message").val('');
closeKeyboard($("#message"));
if(GlobalOnTouch) {
closeKeyboard($("#message"));
}
})
.fail(function(){
if(jqxhr.status == 302) {
$("#message").val('');
closeKeyboard($("#message"));
if(GlobalOnTouch) {
closeKeyboard($("#message"));
}
}
});
}
Expand Down Expand Up @@ -799,7 +804,7 @@ $(document).ready(function(){
$("#form-totoz .form-group").addClass('unfocus').removeClass('focusin');
}
});

//close popover when click outside
$(document).on('click', function (e) {
$('[data-toggle="popover"],[data-original-title]').each(function () {
Expand Down Expand Up @@ -906,8 +911,33 @@ $(document).ready(function(){
/* Interactions tactiles */
/* ********************* */

//detect keyboard appearing/closing
var _originalSize = $(window).width() + $(window).height()
$(window).resize(function(){
if($(window).width() + $(window).height() < _originalSize - 50){
//console.log("keyboard show up");
if($("#form-totoz .popover").length > 0) {
$("#form-totoz input").popover('show');
}
}else{
//console.log("keyboard closed");
if($("#form-totoz .popover").length > 0) {
$("#form-totoz input").popover('show');
}
}
});

//allow text selection
delete Hammer.defaults.cssProps.userSelect;
//touch events on palmi : only to detect device's type
var mcPalmi = new Hammer.Manager(document.getElementById('message'));
mcPalmi.add(new Hammer.Tap({ event: 'tap'}));
mcPalmi.on('tap', function(ev){
if(ev.pointerType == 'touch') {
GlobalOnTouch = true;
}
});
//touch events on Pinni
PreventGhostClick(GlobalPinni);
var mc = new Hammer.Manager(GlobalPinni);

Expand Down Expand Up @@ -949,14 +979,15 @@ $(document).ready(function(){
});

mc.on('singletap', function(ev) {
GlobalOnTouch = true;
if(ev.pointerType == 'touch') {
var target = $(ev.target);
if (target.is('a')
|| target.hasClass('clock')
|| target.hasClass('clockref')
|| target.hasClass('ua')
|| target.hasClass('login')
|| target.hasClass('tab')) {
|| target.hasClass('clock')
|| target.hasClass('clockref')
|| target.hasClass('ua')
|| target.hasClass('login')
|| target.hasClass('tab')) {
if (target.closest('li').hasClass('tab')) {
var boardName = target.closest('li').attr('id').substr(4);
GlobalBoardTabs[boardName].toggle();
Expand All @@ -969,10 +1000,12 @@ $(document).ready(function(){
hilightPost(parent.attr('id'), parent[0]);
}
removeNotif();
$("#form-totoz input").popover('destroy');
}
});

mc.on('swipe', function(ev) {
GlobalOnTouch = true;
if(ev.direction == Hammer.DIRECTION_LEFT && !$("#wrapper").hasClass("toggled")) {
$("#menu-toggle").trigger('click');
} else if(ev.direction == Hammer.DIRECTION_RIGHT && $("#wrapper").hasClass("toggled")) {
Expand All @@ -985,6 +1018,7 @@ $(document).ready(function(){

mc2.add( new Hammer.Swipe({event: 'swipe', direction: Hammer.DIRECTION_HORIZONTAL}));
mc2.on('swipe', function(ev) {
GlobalOnTouch = true;
if(ev.direction == Hammer.DIRECTION_LEFT && !$("#wrapper").hasClass("toggled")) {
$("#menu-toggle").trigger('click');
} else if(ev.direction == Hammer.DIRECTION_RIGHT && $("#wrapper").hasClass("toggled")) {
Expand Down Expand Up @@ -1023,6 +1057,7 @@ $(document).ready(function(){

mc2.on('tap', function(ev){
if(ev.pointerType == 'touch') {
GlobalOnTouch = true;
var target = $(ev.target);
if (target.closest('li').hasClass('tab')) {
var boardName = target.closest('li').attr('id').substr(4);
Expand Down

0 comments on commit 173c810

Please sign in to comment.