Skip to content

Commit

Permalink
Merge pull request tgstation#14528 from neersighted/es6
Browse files Browse the repository at this point in the history
Port tgui to ES6
  • Loading branch information
duncathan committed Jan 13, 2016
2 parents 261295d + f7d829c commit b71e806
Show file tree
Hide file tree
Showing 60 changed files with 654 additions and 574 deletions.
2 changes: 1 addition & 1 deletion code/modules/mob/mob_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ It's fairly easy to fix if dealing with single letters but not so much with comp
return

/proc/IsAdminGhost(var/mob/user)
if(check_rights(R_ADMIN, 0) && istype(user, /mob/dead/observer) && user.client.AI_Interact)
if(check_rights_for(user.client, R_ADMIN) && istype(user, /mob/dead/observer) && user.client.AI_Interact)
return 1
else
return 0
8 changes: 4 additions & 4 deletions code/modules/tgui/states/states.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
var/src_object = ui_host()

if(istype(user, /mob/dead/observer)) // Special-case ghosts.
if(check_rights_for(user.client, R_ADMIN))
if(IsAdminGhost(user))
return UI_INTERACTIVE // Admins can interact anyway.
if(get_dist(src_object, src) > user.client.view)
return UI_CLOSE // Keep ghosts from opening too many UIs.
return UI_UPDATE // Ghosts can only view.
if(get_dist(src_object, src) < user.client.view)
return UI_UPDATE // Keep ghosts from opening too many UIs.
return UI_CLOSE // Ghosts can only view.
return state.can_use_topic(src_object, user) // Check if the state allows interaction.

/**
Expand Down
10 changes: 5 additions & 5 deletions code/modules/tgui/tgui.dm
Original file line number Diff line number Diff line change
Expand Up @@ -257,16 +257,16 @@
* If the src_object's ui_act() returns 1, update all UIs attacked to it.
**/
/datum/tgui/Topic(href, href_list)
var/action = href_list["action"] // Pull the action out.
href_list -= "action"
var/action = href_list["action"]
var/params = href_list; params -= "action"

// Handle any special actions.
switch(action)
if("tgui:initialize")
user << output(url_encode(get_json(initial_data)), "[window_id].browser:initialize")
return
if("tgui:ie")
user << link("http://windows.microsoft.com/en-us/internet-explorer/download-ie")
if("tgui:link")
user << link(params["url"])
return
if("tgui:fancy")
user.client.prefs.tgui_fancy = TRUE
Expand All @@ -279,7 +279,7 @@
if(status != UI_INTERACTIVE || user != usr)
return // If UI is not interactive or usr calling Topic is not the UI user.

var/update = src_object.ui_act(action, href_list, state) // Call ui_act() on the src_object.
var/update = src_object.ui_act(action, params, state) // Call ui_act() on the src_object.
if(src_object && update)
SStgui.update_uis(src_object) // If we have a src_object and its ui_act() told us to update.

Expand Down
8 changes: 8 additions & 0 deletions tgui/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"presets": [
"es2015"
],
"plugins": [
"external-helpers"
]
}
4 changes: 2 additions & 2 deletions tgui/Gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
require('coffee-script/register');
require('./gulp');
require('babel-register')
require('./gulp')
2 changes: 1 addition & 1 deletion tgui/assets/tgui.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 10 additions & 9 deletions tgui/assets/tgui.js

Large diffs are not rendered by default.

6 changes: 0 additions & 6 deletions tgui/coffeelint.json

This file was deleted.

5 changes: 5 additions & 0 deletions tgui/gulp/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"presets": [
"es2015"
]
}
7 changes: 0 additions & 7 deletions tgui/gulp/config/flags.coffee

This file was deleted.

4 changes: 0 additions & 4 deletions tgui/gulp/config/index.coffee

This file was deleted.

16 changes: 0 additions & 16 deletions tgui/gulp/config/plugins.coffee

This file was deleted.

4 changes: 4 additions & 0 deletions tgui/gulp/flags.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const flags = require('minimist')(process.argv.slice(2))

export const debug = flags.debug || flags.d
export const min = flags.min || flags.m
12 changes: 0 additions & 12 deletions tgui/gulp/index.coffee

This file was deleted.

12 changes: 12 additions & 0 deletions tgui/gulp/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import gulp from 'gulp'

import { css, watch_css } from './tasks/css'
import { js, watch_js } from './tasks/js'
import { reload, watch_reload } from './tasks/reload'
import { size } from './tasks/size'

gulp.task(reload)
gulp.task(size)

gulp.task('default', gulp.series(gulp.parallel(css, js), size))
gulp.task('watch', gulp.parallel(watch_css, watch_js, watch_reload))
4 changes: 2 additions & 2 deletions tgui/paths.json → tgui/gulp/paths.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"out":"assets",
"out":"assets/",
"css":{
"dir":"styles/",
"main":"main.styl",
Expand All @@ -11,7 +11,7 @@
},
"js":{
"dir":"scripts/",
"main":"main.coffee",
"main":"main.js",
"out":"tgui.js"
}
}
Loading

0 comments on commit b71e806

Please sign in to comment.