Merge showFileHandler into the event handler

pull/1/head
Alex Beregszaszi 8 years ago
parent fc98e42bbf
commit 0c2e4753c9
  1. 13
      src/app.js

@ -138,6 +138,7 @@ var run = function () {
var $el = $(this) var $el = $(this)
selectTab($el) selectTab($el)
}) })
var selectTab = function (el) { var selectTab = function (el) {
var match = /[a-z]+View/.exec(el.get(0).className) var match = /[a-z]+View/.exec(el.get(0).className)
if (!match) return if (!match) return
@ -220,7 +221,11 @@ var run = function () {
}) })
// Switch tab // Switch tab
$filesEl.on('click', '.file:not(.active)', showFileHandler) $filesEl.on('click', '.file:not(.active)', function (ev) {
ev.preventDefault()
swicthToFile($(this).find('.name').text())
return false
})
// Edit name of current tab // Edit name of current tab
$filesEl.on('click', '.file.active', function (ev) { $filesEl.on('click', '.file.active', function (ev) {
@ -277,12 +282,6 @@ var run = function () {
updateFiles() updateFiles()
} }
function showFileHandler (ev) {
ev.preventDefault()
swicthToFile($(this).find('.name').text())
return false
}
// Synchronise tab list with file names known to the editor // Synchronise tab list with file names known to the editor
function updateFiles () { function updateFiles () {
var $filesEl = $('#files') var $filesEl = $('#files')

Loading…
Cancel
Save