jacobmatthew Posted November 29, 2017 Report Share Posted November 29, 2017 (edited) Hi guys, my pilots are unable to remove bids on mobile, because they have to double click. I was wondering how I can change the "Remove Bid" button to only require one click. Thank you, I'd really appreciate your help! Edited November 29, 2017 by jacobmatthew Quote Link to comment Share on other sites More sharing options...
Moderators servetas Posted November 29, 2017 Moderators Report Share Posted November 29, 2017 After a small search on the internet, I found this. The first reply seems very helpful. It seems that mobile phones do not support the dblclick event and the user who posted it suggests to fake the double click via taking into consideration the interval between the two clicks on the remove bid button. Which phpVMS version are you using? 1 Quote Link to comment Share on other sites More sharing options...
jacobmatthew Posted November 29, 2017 Author Report Share Posted November 29, 2017 6 minutes ago, servetas said: After a small search on the internet, I found this. The first reply seems very helpful. It seems that mobile phones do not support the dblclick event and the user who posted it suggests to fake the double click via taking into consideration the interval between the two clicks on the remove bid button. Which phpVMS version are you using? Thanks for replying, Im using simpilot 5.5.2. Quote Link to comment Share on other sites More sharing options...
Moderators servetas Posted November 29, 2017 Moderators Report Share Posted November 29, 2017 Great! I think that I have managed to do something with the above. Tested it in my mobile phone (safari) and it works. It works on my PC (firefox) too. Open your lib/js/phpvms.js, find this: $('.deleteitem').live('click',function(){return false;}); $('.deleteitem').live('dblclick', function(){ $.post($(this).attr("href"), {id: $(this).attr("id")}); rmvid= "#bid"+$(this).attr("id"); $(rmvid).slideUp(); return false; }); and replace it with this: var touchtime = 0; $('.deleteitem').live('click', function() { if(touchtime == 0) { touchtime = new Date().getTime(); } else { if(((new Date().getTime())-touchtime) < 1000) { $.post($(this).attr("href"), {id: $(this).attr("id")}); rmvid= "#bid"+$(this).attr("id"); $(rmvid).slideUp(); touchtime = 0; } else { touchtime = 0; } } return false; }); Let us know if that solves the issue for you. In general, you have to be fast when you double click on the remove bid link. If you want to make it less sensitive, you can increase number 1000 from the above pasted code. In stackoverflow they had it to 800 and I increased it to 1000. Quote Link to comment Share on other sites More sharing options...
jacobmatthew Posted November 29, 2017 Author Report Share Posted November 29, 2017 1 minute ago, servetas said: Great! I think that I have managed to do something with the above. Tested it in my mobile phone (safari) and it works. It works on my PC (firefox) too. Open your lib/js/phpvms.js, find this: $('.deleteitem').live('click',function(){return false;}); $('.deleteitem').live('dblclick', function(){ $.post($(this).attr("href"), {id: $(this).attr("id")}); rmvid= "#bid"+$(this).attr("id"); $(rmvid).slideUp(); return false; }); and replace it with this: var touchtime = 0; $('.deleteitem').live('click', function() { if(touchtime == 0) { touchtime = new Date().getTime(); } else { if(((new Date().getTime())-touchtime) < 1000) { $.post($(this).attr("href"), {id: $(this).attr("id")}); rmvid= "#bid"+$(this).attr("id"); $(rmvid).slideUp(); touchtime = 0; } else { touchtime = 0; } } return false; }); Let us know if that solves the issue for you. In general, you have to be fast when you double click on the remove bid link. If you want to make it less sensitive, you can increase number 1000 from the above pasted code. In stackoverflow they had it to 800 and I increased it to 1000. Would this be my code to remove the bid: <a id="<?php echo $bid->bidid; ?>" class="target" href="<?php echo url('/schedules/removebid');?>">Remove Bid *</a> Or do I just use the default one? Quote Link to comment Share on other sites More sharing options...
Moderators servetas Posted November 29, 2017 Moderators Report Share Posted November 29, 2017 The selector in the last code I pasted is :"$('.deleteitem')". If it was "target" you would have to change your schedule_bids file too. Now you do not need to. +1 for pointing that 1 Quote Link to comment Share on other sites More sharing options...
jacobmatthew Posted November 29, 2017 Author Report Share Posted November 29, 2017 Hmm, Its not working. Heres my lib/js/phpvms.js file: /** * phpVMS - Virtual Airline Administration Software * Copyright (c) 2008 Nabeel Shahzad * For more information, visit www.phpvms.net * Forums: http://www.phpvms.net/forum * Documentation: http://www.phpvms.net/docs * * phpVMS is licenced under the following license: * Creative Commons Attribution Non-commercial Share Alike (by-nc-sa) * View license.txt in the root, or visit http://creativecommons.org/licenses/by-nc-sa/3.0/ * * @author Nabeel Shahzad * @copyright Copyright (c) 2008, Nabeel Shahzad * @link http://www.phpvms.net * @license http://creativecommons.org/licenses/by-nc-sa/3.0/ */ // Icons for Google Maps //var url = window.location.href.split("index.php")[0]; var url = window.location.href.split("index.php")[0]; var depicon = url + '/lib/images/towerdeparture.png'; var arricon = url + '/lib/images/towerarrival.png'; // Everything else $(document).ready(function() { $("#form, .ajaxform").ajaxForm({ target: '#scheduleresults', beforeSubmit: function (x,y,z) { $("#scheduleresults").html('<div align="center"><img src="'+url+'/lib/images/loading.gif" /><br />Searching...</div>'); }, success: function() { $('#bodytext').fadeIn('slow'); } }); $(document).on("change", "#code", function() { $("#depairport").load(url+"action.php/pireps/getdeptapts/"+$(this).val()); }); $("#tabcontainer").tabs(); var touchtime = 0; $('.deleteitem').live('click', function() { if(touchtime == 0) { touchtime = new Date().getTime(); } else { if(((new Date().getTime())-touchtime) < 1000) { $.post($(this).attr("href"), {id: $(this).attr("id")}); rmvid= "#bid"+$(this).attr("id"); $(rmvid).slideUp(); touchtime = 0; } else { touchtime = 0; } } return false; }); $(document).on('click', '.addbid', function(){ var id = "#"+$(this).attr("id"); $.get(url+"action.php/schedules/addbid?id="+$(this).attr("id"), function (data) { $(id).html(data); return false; }); return false; }); $("div .metar").each(function(){ icao=$(this).attr("id"); $.getJSON(geourl+"/weatherIcaoJSON?ICAO="+icao+"&callback=?", function(data){ if(data.length == 0) { html = "Could not load METAR information"; } else { data.weatherObservation.observation = data.weatherObservation.observation.replace("$", ""); html = "<strong>METAR: </strong>"+data.weatherObservation.observation+"<br />"; } $("#"+data.weatherObservation.ICAO).html(html); }); }); }); // Simple JavaScript Templating // John Resig - http://ejohn.org/ - MIT Licensed (function(){ var cache = {}; this.tmpl = function tmpl(str, data){ // Figure out if we're getting a template, or if we need to // load the template - and be sure to cache the result. var fn = !/\W/.test(str) ? cache[str] = cache[str] || tmpl(document.getElementById(str).innerHTML) : // Generate a reusable function that will serve as a template // generator (and which will be cached). new Function("obj", "var p=[],print=function(){p.push.apply(p,arguments);};" + // Introduce the data as local variables using with(){} "with(obj){p.push('" + // Convert the template into pure JavaScript str .replace(/[\r\t\n]/g, " ") .split("<%").join("\t") .replace(/((^|%>)[^\t]*)'/g, "$1\r") .replace(/\t=(.*?)%>/g, "',$1,'") .split("\t").join("');") .split("%>").join("p.push('") .split("\r").join("\\'") + "');}return p.join('');"); // Provide some basic currying to the user return data ? fn( data ) : fn; }; })(); And my code in schedules_bid.php <a id="<?php echo $bid->bidid; ?>" class="deleteitem" href="<?php echo url('/schedules/removebid');?>">Remove Bid *</a> It justs redirects me to /schedules/removebid Quote Link to comment Share on other sites More sharing options...
Moderators servetas Posted November 29, 2017 Moderators Report Share Posted November 29, 2017 Sorry, it was my fault. I was working on phpVMS 2 and forgot to make the required updates. Please replace this: $('.deleteitem').live('click', function() { with this: $('.deleteitem').on('click', function() { 1 Quote Link to comment Share on other sites More sharing options...
jacobmatthew Posted November 29, 2017 Author Report Share Posted November 29, 2017 (edited) 10 minutes ago, servetas said: Sorry, it was my fault. I was working on phpVMS 2 and forgot to make the required updates. Please replace this: $('.deleteitem').live('click', function() { with this: $('.deleteitem').on('click', function() { Wow, thank you so much. You are very helpful. I thought this was never going to be solved, lol. Edited November 29, 2017 by jacobmatthew Quote Link to comment Share on other sites More sharing options...
Moderators servetas Posted November 29, 2017 Moderators Report Share Posted November 29, 2017 I thought that too in the beginning but nothing is impossible Quote Link to comment Share on other sites More sharing options...
opsman Posted March 8, 2018 Report Share Posted March 8, 2018 simpilot 5.5.2 code is different to this however i get several warning when editing the page in dreamweaver. i tried reverting back to this code above and it takes me to schedules/removebid ive also checked and I’ve got the following line as mentioned as well. $('.deleteitem').on('click', function() { any further thoughts? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.