2014-11-10 18:19:04 +01:00
|
|
|
#= require jquery
|
|
|
|
#= require jquery_ujs
|
2014-11-11 18:16:09 +01:00
|
|
|
#= require jquery.turbolinks
|
2015-09-20 15:16:24 +02:00
|
|
|
#= require jquery.arctic_scroll
|
2014-11-10 18:19:04 +01:00
|
|
|
#= require turbolinks
|
|
|
|
#= require bootstrap
|
2015-06-13 16:53:11 +02:00
|
|
|
#= require twemoji
|
2015-01-13 19:49:43 +01:00
|
|
|
#= require nprogress
|
|
|
|
#= require nprogress-turbolinks
|
2014-11-28 21:35:44 +01:00
|
|
|
#= require growl
|
2014-12-21 22:29:52 +01:00
|
|
|
#= require cheet
|
2014-12-29 15:47:10 +01:00
|
|
|
#= require jquery.guillotine
|
2015-05-12 23:53:42 +02:00
|
|
|
#= require jquery.particleground
|
2017-03-31 22:49:38 +02:00
|
|
|
#= require sweetalert
|
2015-06-08 16:49:47 +02:00
|
|
|
#= require js.cookie
|
2015-06-08 16:01:16 +02:00
|
|
|
#= require i18n
|
2015-06-08 16:50:59 +02:00
|
|
|
#= require i18n/translations
|
2015-07-29 17:08:07 +02:00
|
|
|
#= require tinycolor-min
|
2015-08-25 20:27:06 +02:00
|
|
|
#= require jquery.minicolors
|
2015-02-03 17:31:04 +01:00
|
|
|
# local requires to be seen by everyone:
|
|
|
|
#= require_tree ./answerbox
|
|
|
|
#= require_tree ./questionbox
|
|
|
|
#= require groups
|
|
|
|
#= require inbox
|
|
|
|
#= require memes
|
|
|
|
#= require notifications
|
|
|
|
#= require pagination
|
|
|
|
#= require piwik
|
|
|
|
#= require question
|
|
|
|
#= require settings
|
|
|
|
#= require user
|
2015-04-22 04:59:10 +02:00
|
|
|
#= require report
|
2015-06-21 09:03:29 +02:00
|
|
|
#= require locale-box
|
2015-07-29 17:08:07 +02:00
|
|
|
#= require util
|
2015-02-03 17:31:04 +01:00
|
|
|
# not required:
|
|
|
|
# _tree ./moderation
|
2014-11-10 18:19:04 +01:00
|
|
|
|
2015-01-13 19:49:43 +01:00
|
|
|
NProgress.configure
|
|
|
|
showSpinner: false
|
2014-11-10 18:19:04 +01:00
|
|
|
|
2015-06-08 16:49:47 +02:00
|
|
|
window.translate = (scope, options) ->
|
|
|
|
# for some reason I18n errors when calling it by assign proxy, so we got to wrap it
|
|
|
|
I18n.translate(scope, options)
|
|
|
|
|
2014-12-08 15:42:34 +01:00
|
|
|
window.showNotification = (text, success=true) ->
|
2014-11-28 21:35:44 +01:00
|
|
|
args =
|
2015-06-08 16:49:47 +02:00
|
|
|
title: translate((if success then 'frontend.success.title' else 'frontend.error.title'))
|
2014-11-28 21:35:44 +01:00
|
|
|
message: text
|
|
|
|
if success
|
|
|
|
$.growl.notice args
|
|
|
|
else
|
|
|
|
$.growl.error args
|
2014-11-11 18:02:59 +01:00
|
|
|
|
2015-06-08 16:49:47 +02:00
|
|
|
I18n.defaultLocale = 'en';
|
|
|
|
I18n.locale = Cookies.get('hl') || 'en';
|
|
|
|
|
|
|
|
window.showNotificationXHRError = (jqxhr, status, error) ->
|
|
|
|
console.log jqxhr, status, error
|
|
|
|
showNotification translate('frontend.error.message'), false
|
|
|
|
|
2014-11-10 18:19:04 +01:00
|
|
|
$(document).on "click", "button#create-account", ->
|
|
|
|
Turbolinks.visit "/sign_up"
|
2015-01-03 19:43:51 +01:00
|
|
|
|
|
|
|
_ready = ->
|
2015-04-23 02:56:29 +02:00
|
|
|
if typeof sweetAlertInitialize != "undefined"
|
|
|
|
sweetAlertInitialize()
|
2015-01-03 19:43:51 +01:00
|
|
|
|
2015-05-27 07:41:38 +02:00
|
|
|
if document.getElementById('particles')?
|
2015-07-29 17:08:07 +02:00
|
|
|
jumbo = $ '.j2-jumbo'
|
|
|
|
bodyColorOrig = jumbo.css 'background-color'
|
|
|
|
bodyColor = doppler 0.25, bodyColorOrig
|
|
|
|
console.log bodyColor, bodyColorOrig
|
2015-05-27 07:41:38 +02:00
|
|
|
particleground document.getElementById('particles'),
|
2015-07-29 17:08:07 +02:00
|
|
|
dotColor: bodyColor
|
|
|
|
lineColor: bodyColor
|
2015-09-20 15:16:24 +02:00
|
|
|
density: 23000
|
2015-05-12 23:53:42 +02:00
|
|
|
|
2015-06-13 16:53:11 +02:00
|
|
|
if twemoji?
|
|
|
|
twemoji.parse document.body,
|
|
|
|
size: 16
|
|
|
|
callback: (icon, options) ->
|
|
|
|
switch icon
|
|
|
|
# copyright, registered, trademark
|
|
|
|
when 'a9' or 'ae' or '2122'
|
|
|
|
false
|
|
|
|
else
|
|
|
|
''.concat(options.base, options.size, '/', icon, options.ext)
|
|
|
|
|
2015-09-20 15:16:24 +02:00
|
|
|
$('.arctic_scroll').arctic_scroll speed: 500
|
|
|
|
|
2015-06-13 16:53:11 +02:00
|
|
|
|
2015-01-03 19:43:51 +01:00
|
|
|
$(document).ready _ready
|
2015-01-07 19:58:43 +01:00
|
|
|
$(document).on 'page:load', _ready
|