Skip to content

Instantly share code, notes, and snippets.

@zixaphir
Created September 13, 2012 22:41
Show Gist options
  • Save zixaphir/3718254 to your computer and use it in GitHub Desktop.
Save zixaphir/3718254 to your computer and use it in GitHub Desktop.
$.on $('a.delete', div), 'click', ->
container = @.parentElement.parentElement
unless container.previousSibling or container.nextSibling
alert "Cannot delete theme (No other themes available)."
return
if container.id == Conf['theme']
if settheme = container.previousSibling
$.addClass settheme, 'selectedtheme'
$.set 'theme', settheme.id
Conf['theme'] = settheme.id
else if settheme = container.nextSibling
$.addClass settheme, 'selectedtheme'
$.set 'theme', settheme.id
Conf['theme'] = settheme.id
userThemes[container.id]["Deleted"] = true
$.set 'userThemes', userThemes
$.rm container
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment