id stringlengths 34 124 | type stringclasses 4
values | prompt stringlengths 0 4.95k | response stringlengths 21 4.89k | source_lang stringclasses 3
values | target_lang stringclasses 2
values | repo stringclasses 75
values | path stringlengths 10 88 | license stringclasses 1
value | commit stringlengths 40 40 | stars int64 431 18.7k | source_url stringlengths 86 176 | line_start int64 1 214 | line_end int64 3 253 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
littlebee/git-time-machine:spec/git-time-machine-view-spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
$ = jQuery = require 'jquery'
GitTimeMachineView = require '../lib/git-time-machine-view'
GitUtils = require '../lib/git-utils'
describe "GitTimeMachineView", ->
describe "when open", ->
[workspaceElement, activationPromise, timeMachineElement] = []
... | var $, GitTimeMachineView, GitUtils, jQuery;
$ = jQuery = require('jquery');
GitTimeMachineView = require('../lib/git-time-machine-view');
GitUtils = require('../lib/git-utils');
describe("GitTimeMachineView", function() {
return describe("when open", function() {
var activationPromise, timeMachineElement, wo... | CoffeeScript | JavaScript | littlebee/git-time-machine | spec/git-time-machine-view-spec.coffee | MIT | 75db344a83bc61673bfb7c5d59cd3ac78c90e095 | 1,111 | https://github.com/littlebee/git-time-machine/blob/75db344a83bc61673bfb7c5d59cd3ac78c90e095/spec/git-time-machine-view-spec.coffee | 1 | 46 |
littlebee/git-time-machine:spec/git-time-machine-view-spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var $, GitTimeMachineView, GitUtils, jQuery;
$ = jQuery = require('jquery');
GitTimeMachineView = require('../lib/git-time-machine-view');
GitUtils = require('../lib/git-utils');
describe("GitTimeMachineView", function() {
return describe("when open", functio... | $ = jQuery = require 'jquery'
GitTimeMachineView = require '../lib/git-time-machine-view'
GitUtils = require '../lib/git-utils'
describe "GitTimeMachineView", ->
describe "when open", ->
[workspaceElement, activationPromise, timeMachineElement] = []
beforeEach ->
workspaceElement = atom.views.getVi... | JavaScript | CoffeeScript | littlebee/git-time-machine | spec/git-time-machine-view-spec.coffee | MIT | 75db344a83bc61673bfb7c5d59cd3ac78c90e095 | 1,111 | https://github.com/littlebee/git-time-machine/blob/75db344a83bc61673bfb7c5d59cd3ac78c90e095/spec/git-time-machine-view-spec.coffee | 1 | 46 |
littlebee/git-time-machine:spec/git-time-machine-view-spec.coffee:1:completion | completion | $ = jQuery = require 'jquery'
GitTimeMachineView = require '../lib/git-time-machine-view'
GitUtils = require '../lib/git-utils'
describe "GitTimeMachineView", ->
describe "when open", ->
[workspaceElement, activationPromise, timeMachineElement] = []
beforeEach ->
workspaceElement = atom.views.getVi... | describe "after opening a known file", ->
beforeEach ->
spyOn(GitUtils, '_onFinishedParse').andCallThrough()
openPromise = atom.workspace.open('test-data/fiveCommits.txt')
waitsForPromise ->
return openPromise
waitsFor ->
GitUtils._onFinishedParse.calls.length >... | CoffeeScript | CoffeeScript | littlebee/git-time-machine | spec/git-time-machine-view-spec.coffee | MIT | 75db344a83bc61673bfb7c5d59cd3ac78c90e095 | 1,111 | https://github.com/littlebee/git-time-machine/blob/75db344a83bc61673bfb7c5d59cd3ac78c90e095/spec/git-time-machine-view-spec.coffee | 1 | 46 |
littlebee/git-time-machine:spec/git-time-machine-view-spec.coffee:1:raw_corpus | raw_corpus | GitTimeMachineView = require '../lib/git-time-machine-view'
describe "GitTimeMachineView", ->
it "has one valid test", ->
expect("life").toBe "easy" | CoffeeScript | littlebee/git-time-machine | spec/git-time-machine-view-spec.coffee | MIT | 5545cea64434a8c151856e362471555ead365199 | 1,111 | https://github.com/littlebee/git-time-machine/blob/5545cea64434a8c151856e362471555ead365199/spec/git-time-machine-view-spec.coffee | 1 | 5 | ||
littlebee/git-time-machine:spec/git-time-machine-view-spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
GitTimeMachineView = require '../lib/git-time-machine-view'
describe "GitTimeMachineView", ->
it "has one valid test", ->
expect("life").toBe "easy"
``` | var GitTimeMachineView;
GitTimeMachineView = require('../lib/git-time-machine-view');
describe("GitTimeMachineView", function() {
return it("has one valid test", function() {
return expect("life").toBe("easy");
});
}); | CoffeeScript | JavaScript | littlebee/git-time-machine | spec/git-time-machine-view-spec.coffee | MIT | 5545cea64434a8c151856e362471555ead365199 | 1,111 | https://github.com/littlebee/git-time-machine/blob/5545cea64434a8c151856e362471555ead365199/spec/git-time-machine-view-spec.coffee | 1 | 5 |
littlebee/git-time-machine:spec/git-time-machine-view-spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var GitTimeMachineView;
GitTimeMachineView = require('../lib/git-time-machine-view');
describe("GitTimeMachineView", function() {
return it("has one valid test", function() {
return expect("life").toBe("easy");
});
});
``` | GitTimeMachineView = require '../lib/git-time-machine-view'
describe "GitTimeMachineView", ->
it "has one valid test", ->
expect("life").toBe "easy" | JavaScript | CoffeeScript | littlebee/git-time-machine | spec/git-time-machine-view-spec.coffee | MIT | 5545cea64434a8c151856e362471555ead365199 | 1,111 | https://github.com/littlebee/git-time-machine/blob/5545cea64434a8c151856e362471555ead365199/spec/git-time-machine-view-spec.coffee | 1 | 5 |
littlebee/git-time-machine:spec/git-time-machine-view-spec.coffee:1:completion | completion | GitTimeMachineView = require '../lib/git-time-machine-view' | describe "GitTimeMachineView", ->
it "has one valid test", ->
expect("life").toBe "easy" | CoffeeScript | CoffeeScript | littlebee/git-time-machine | spec/git-time-machine-view-spec.coffee | MIT | 5545cea64434a8c151856e362471555ead365199 | 1,111 | https://github.com/littlebee/git-time-machine/blob/5545cea64434a8c151856e362471555ead365199/spec/git-time-machine-view-spec.coffee | 1 | 5 |
jianliaoim/talk-os:talk-web/client/mixin/message-content.coffee:1:raw_corpus | raw_corpus | module.exports =
hasContent: ->
# can be array or string
content = @props.message.get('body')
content? and content.length > 0
getDslTable: ->
_teamId = @props.message.get('_teamId')
contacts = query.contactsBy(recorder.getState(), _teamId) # an immutable store
if contacts?
contacts
... | CoffeeScript | jianliaoim/talk-os | talk-web/client/mixin/message-content.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/mixin/message-content.coffee | 26 | 75 | ||
jianliaoim/talk-os:talk-web/client/mixin/message-content.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports =
hasContent: ->
# can be array or string
content = @props.message.get('body')
content? and content.length > 0
getDslTable: ->
_teamId = @props.message.get('_teamId')
contacts = query.contactsBy(recorder.getState(), _teamI... | module.exports = {
hasContent: function() {
var content;
// can be array or string
content = this.props.message.get('body');
return (content != null) && content.length > 0;
},
getDslTable: function() {
var _teamId, contacts;
_teamId = this.props.message.get('_teamId');
contacts = query... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/mixin/message-content.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/mixin/message-content.coffee | 26 | 75 |
jianliaoim/talk-os:talk-web/client/mixin/message-content.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports = {
hasContent: function() {
var content;
// can be array or string
content = this.props.message.get('body');
return (content != null) && content.length > 0;
},
getDslTable: function() {
var _teamId, contacts;
_teamId = ... | module.exports =
hasContent: ->
# can be array or string
content = @props.message.get('body')
content? and content.length > 0
getDslTable: ->
_teamId = @props.message.get('_teamId')
contacts = query.contactsBy(recorder.getState(), _teamId) # an immutable store
if contacts?
contacts
... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/mixin/message-content.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/mixin/message-content.coffee | 26 | 75 |
jianliaoim/talk-os:talk-web/client/mixin/message-content.coffee:1:completion | completion | module.exports =
hasContent: ->
# can be array or string
content = @props.message.get('body')
content? and content.length > 0
getDslTable: ->
_teamId = @props.message.get('_teamId')
contacts = query.contactsBy(recorder.getState(), _teamId) # an immutable store
if contacts?
contacts
... | * 则去探测是否是有效的邀请链接
* 并发出邀请 request
*
* [部分逻辑具有问题, 等待改良]
###
onInviteMember: (talkUrl) ->
userId = talkUrl.query._userId
if not userId?
messageActions.deleteLocal @props.message
return
_teamId = @props.message.get '_teamId'
if @props.message.get('_roomId')?
_roomId = @props... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/mixin/message-content.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/mixin/message-content.coffee | 26 | 75 |
jianliaoim/talk-os:talk-web/client/mixin/message-content.coffee:2:raw_corpus | raw_corpus | onContentClick: (event) ->
if event.target.tagName is 'A'
event.stopPropagation()
event.preventDefault()
href = event.target.href or ''
talkUrl = parse href, true
mentionId = event.target.dataset.mentionId
roomId = event.target.dataset.roomId
_teamId = @props.message.get('_... | CoffeeScript | jianliaoim/talk-os | talk-web/client/mixin/message-content.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/mixin/message-content.coffee | 76 | 125 | ||
jianliaoim/talk-os:talk-web/client/mixin/message-content.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
onContentClick: (event) ->
if event.target.tagName is 'A'
event.stopPropagation()
event.preventDefault()
href = event.target.href or ''
talkUrl = parse href, true
mentionId = event.target.dataset.mentionId
roomId = event.ta... | ({
onContentClick: function(event) {
var _teamId, href, mentionId, roomId, routePath, talkUrl;
if (event.target.tagName === 'A') {
event.stopPropagation();
event.preventDefault();
href = event.target.href || '';
talkUrl = parse(href, true);
mentionId = event.target.dataset.mentio... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/mixin/message-content.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/mixin/message-content.coffee | 76 | 125 |
jianliaoim/talk-os:talk-web/client/mixin/message-content.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
onContentClick: function(event) {
var _teamId, href, mentionId, roomId, routePath, talkUrl;
if (event.target.tagName === 'A') {
event.stopPropagation();
event.preventDefault();
href = event.target.href || '';
talkUrl = parse(hre... | onContentClick: (event) ->
if event.target.tagName is 'A'
event.stopPropagation()
event.preventDefault()
href = event.target.href or ''
talkUrl = parse href, true
mentionId = event.target.dataset.mentionId
roomId = event.target.dataset.roomId
_teamId = @props.message.get('_... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/mixin/message-content.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/mixin/message-content.coffee | 76 | 125 |
jianliaoim/talk-os:talk-web/client/mixin/message-content.coffee:2:completion | completion | onContentClick: (event) ->
if event.target.tagName is 'A'
event.stopPropagation()
event.preventDefault()
href = event.target.href or ''
talkUrl = parse href, true
mentionId = event.target.dataset.mentionId
roomId = event.target.dataset.roomId
_teamId = @props.message.get('_... | analytics.viewLink()
makeTag: (dsl) ->
switch dsl.category
when 'at'
if dsl.model is 'all'
"<strong>@#{lang.getText('all-members')}</strong>"
else
"<a data-mention-id=\"#{dsl.model}\">#{dsl.view}</a>"
when 'room'
"<a data-room-id=\"#{dsl.model}\">#{dsl.view... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/mixin/message-content.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/mixin/message-content.coffee | 76 | 125 |
jianliaoim/talk-os:talk-web/client/mixin/message-content.coffee:3:raw_corpus | raw_corpus | renderContent: ->
body = @props.message.get('body') or ''
displayType = @props.message.get('displayType')
if body.length > 1000
div className: 'content', onClick: @onContentClick, body
else
content = msgDsl.update msgDsl.read(body), @getDslTable()
if displayType is 'markdown'
... | CoffeeScript | jianliaoim/talk-os | talk-web/client/mixin/message-content.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/mixin/message-content.coffee | 126 | 149 | ||
jianliaoim/talk-os:talk-web/client/mixin/message-content.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
renderContent: ->
body = @props.message.get('body') or ''
displayType = @props.message.get('displayType')
if body.length > 1000
div className: 'content', onClick: @onContentClick, body
else
content = msgDsl.update msgDsl.read(body), @... | ({
renderContent: function() {
var body, content, displayType;
body = this.props.message.get('body') || '';
displayType = this.props.message.get('displayType');
if (body.length > 1000) {
return div({
className: 'content',
onClick: this.onContentClick
}, body);
} else {
... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/mixin/message-content.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/mixin/message-content.coffee | 126 | 149 |
jianliaoim/talk-os:talk-web/client/mixin/message-content.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
renderContent: function() {
var body, content, displayType;
body = this.props.message.get('body') || '';
displayType = this.props.message.get('displayType');
if (body.length > 1000) {
return div({
className: 'content',
onC... | renderContent: ->
body = @props.message.get('body') or ''
displayType = @props.message.get('displayType')
if body.length > 1000
div className: 'content', onClick: @onContentClick, body
else
content = msgDsl.update msgDsl.read(body), @getDslTable()
if displayType is 'markdown'
... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/mixin/message-content.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/mixin/message-content.coffee | 126 | 149 |
jianliaoim/talk-os:talk-web/client/mixin/message-content.coffee:3:completion | completion | renderContent: ->
body = @props.message.get('body') or ''
displayType = @props.message.get('displayType')
if body.length > 1000
div className: 'content', onClick: @onContentClick, body
else
content = msgDsl.update msgDsl.read(body), @getDslTable()
if displayType is 'markdown'
... | content = content
.replace /\{\{__([\w-]+)\}\}/g, (raw, key) ->
text = lang.getText(key)
if text then text else raw
if displayType is 'markdown'
div className: 'content', onClick: @onContentClick,
Markdown value: content
else
content = emojiUtil.replace conte... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/mixin/message-content.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/mixin/message-content.coffee | 126 | 149 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:1:raw_corpus | raw_corpus | applyToPanel = (e) ->
# Settings panel
for d in S.Settings.settings
applyTextContentBySettingsId(d)
sv = document.querySelector('.settings-view')
# Keybindings
info = sv.querySelector('.keybinding-panel>div:nth-child(2)')
unless isAlreadyLocalized(info)
info.querySelector('span:nth-child(2)').text... | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 6f30002d0b09486e596bee1980a6b15aca725a1e | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/6f30002d0b09486e596bee1980a6b15aca725a1e/tools/settings.coffee | 5 | 54 | ||
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
applyToPanel = (e) ->
# Settings panel
for d in S.Settings.settings
applyTextContentBySettingsId(d)
sv = document.querySelector('.settings-view')
# Keybindings
info = sv.querySelector('.keybinding-panel>div:nth-child(2)')
unless isAlreadyLocaliz... | var applyToPanel;
applyToPanel = function(e) {
var d, i, info, inst, len, ref, span, sv, tc, tp1, tp2;
ref = S.Settings.settings;
// Settings panel
for (i = 0, len = ref.length; i < len; i++) {
d = ref[i];
applyTextContentBySettingsId(d);
}
sv = document.querySelector('.settings-view');
// Keybin... | CoffeeScript | JavaScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 6f30002d0b09486e596bee1980a6b15aca725a1e | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/6f30002d0b09486e596bee1980a6b15aca725a1e/tools/settings.coffee | 5 | 54 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var applyToPanel;
applyToPanel = function(e) {
var d, i, info, inst, len, ref, span, sv, tc, tp1, tp2;
ref = S.Settings.settings;
// Settings panel
for (i = 0, len = ref.length; i < len; i++) {
d = ref[i];
applyTextContentBySettingsId(d);
}
sv ... | applyToPanel = (e) ->
# Settings panel
for d in S.Settings.settings
applyTextContentBySettingsId(d)
sv = document.querySelector('.settings-view')
# Keybindings
info = sv.querySelector('.keybinding-panel>div:nth-child(2)')
unless isAlreadyLocalized(info)
info.querySelector('span:nth-child(2)').text... | JavaScript | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 6f30002d0b09486e596bee1980a6b15aca725a1e | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/6f30002d0b09486e596bee1980a6b15aca725a1e/tools/settings.coffee | 5 | 54 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:1:completion | completion | applyToPanel = (e) ->
# Settings panel
for d in S.Settings.settings
applyTextContentBySettingsId(d)
sv = document.querySelector('.settings-view')
# Keybindings
info = sv.querySelector('.keybinding-panel>div:nth-child(2)')
unless isAlreadyLocalized(info)
info.querySelector('span:nth-child(2)').text... | # console.log info
info.appendChild(span)
tp1 = sv.querySelector('.themes-picker>div:nth-child(1)')
tp1.querySelector('.setting-title').textContent = "UI 主题"
tp1.querySelector('.setting-description').textContent = "该主题将应用在标签,状态栏,树形视图和下拉菜单等。"
tp2 = sv.querySelector('.themes-picker>div:nth-child(2)')
... | CoffeeScript | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 6f30002d0b09486e596bee1980a6b15aca725a1e | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/6f30002d0b09486e596bee1980a6b15aca725a1e/tools/settings.coffee | 5 | 54 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:3:raw_corpus | raw_corpus | applyInstallPanelOnSwitch = () ->
applySectionHeadings(true)
applyButtonToolbar()
inst = document.querySelector('div.section:not(.themes-panel)')
info = inst.querySelector('.native-key-bindings')
info.querySelector('span:nth-child(2)').textContent = "扩展·主题 " | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 6f30002d0b09486e596bee1980a6b15aca725a1e | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/6f30002d0b09486e596bee1980a6b15aca725a1e/tools/settings.coffee | 63 | 68 | ||
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
applyInstallPanelOnSwitch = () ->
applySectionHeadings(true)
applyButtonToolbar()
inst = document.querySelector('div.section:not(.themes-panel)')
info = inst.querySelector('.native-key-bindings')
info.querySelector('span:nth-child(2)').textContent = "扩展... | var applyInstallPanelOnSwitch;
applyInstallPanelOnSwitch = function() {
var info, inst;
applySectionHeadings(true);
applyButtonToolbar();
inst = document.querySelector('div.section:not(.themes-panel)');
info = inst.querySelector('.native-key-bindings');
return info.querySelector('span:nth-child(2)').textCo... | CoffeeScript | JavaScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 6f30002d0b09486e596bee1980a6b15aca725a1e | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/6f30002d0b09486e596bee1980a6b15aca725a1e/tools/settings.coffee | 63 | 68 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var applyInstallPanelOnSwitch;
applyInstallPanelOnSwitch = function() {
var info, inst;
applySectionHeadings(true);
applyButtonToolbar();
inst = document.querySelector('div.section:not(.themes-panel)');
info = inst.querySelector('.native-key-bindings');
... | applyInstallPanelOnSwitch = () ->
applySectionHeadings(true)
applyButtonToolbar()
inst = document.querySelector('div.section:not(.themes-panel)')
info = inst.querySelector('.native-key-bindings')
info.querySelector('span:nth-child(2)').textContent = "扩展·主题 " | JavaScript | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 6f30002d0b09486e596bee1980a6b15aca725a1e | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/6f30002d0b09486e596bee1980a6b15aca725a1e/tools/settings.coffee | 63 | 68 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:3:completion | completion | applyInstallPanelOnSwitch = () ->
applySectionHeadings(true)
applyButtonToolbar() | inst = document.querySelector('div.section:not(.themes-panel)')
info = inst.querySelector('.native-key-bindings')
info.querySelector('span:nth-child(2)').textContent = "扩展·主题 " | CoffeeScript | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 6f30002d0b09486e596bee1980a6b15aca725a1e | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/6f30002d0b09486e596bee1980a6b15aca725a1e/tools/settings.coffee | 63 | 68 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:4:raw_corpus | raw_corpus | applySpecialHeading = (area, org, childIdx, text) ->
sh = getTextMatchElement(area, '.section-heading', org)
return unless sh && !isAlreadyLocalized(sh)
sh.childNodes[childIdx].textContent = null
span = document.createElement('span')
span.textContent = org
applyTextWithOrg(span, text)
sh.appendChild(span) | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 6f30002d0b09486e596bee1980a6b15aca725a1e | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/6f30002d0b09486e596bee1980a6b15aca725a1e/tools/settings.coffee | 70 | 77 | ||
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
applySpecialHeading = (area, org, childIdx, text) ->
sh = getTextMatchElement(area, '.section-heading', org)
return unless sh && !isAlreadyLocalized(sh)
sh.childNodes[childIdx].textContent = null
span = document.createElement('span')
span.textContent = ... | var applySpecialHeading;
applySpecialHeading = function(area, org, childIdx, text) {
var sh, span;
sh = getTextMatchElement(area, '.section-heading', org);
if (!(sh && !isAlreadyLocalized(sh))) {
return;
}
sh.childNodes[childIdx].textContent = null;
span = document.createElement('span');
span.textCon... | CoffeeScript | JavaScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 6f30002d0b09486e596bee1980a6b15aca725a1e | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/6f30002d0b09486e596bee1980a6b15aca725a1e/tools/settings.coffee | 70 | 77 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var applySpecialHeading;
applySpecialHeading = function(area, org, childIdx, text) {
var sh, span;
sh = getTextMatchElement(area, '.section-heading', org);
if (!(sh && !isAlreadyLocalized(sh))) {
return;
}
sh.childNodes[childIdx].textContent = null;
... | applySpecialHeading = (area, org, childIdx, text) ->
sh = getTextMatchElement(area, '.section-heading', org)
return unless sh && !isAlreadyLocalized(sh)
sh.childNodes[childIdx].textContent = null
span = document.createElement('span')
span.textContent = org
applyTextWithOrg(span, text)
sh.appendChild(span) | JavaScript | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 6f30002d0b09486e596bee1980a6b15aca725a1e | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/6f30002d0b09486e596bee1980a6b15aca725a1e/tools/settings.coffee | 70 | 77 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:4:completion | completion | applySpecialHeading = (area, org, childIdx, text) ->
sh = getTextMatchElement(area, '.section-heading', org)
return unless sh && !isAlreadyLocalized(sh)
sh.childNodes[childIdx].textContent = null | span = document.createElement('span')
span.textContent = org
applyTextWithOrg(span, text)
sh.appendChild(span) | CoffeeScript | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 6f30002d0b09486e596bee1980a6b15aca725a1e | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/6f30002d0b09486e596bee1980a6b15aca725a1e/tools/settings.coffee | 70 | 77 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:5:raw_corpus | raw_corpus | applySectionHeadings = (force) ->
sv = document.querySelector('.settings-view')
for sh in S.Settings.sectionHeadings
el = getTextMatchElement(sv, '.section-heading', sh.label)
continue unless el
if !isAlreadyLocalized(el) and force
applyTextWithOrg(el, sh.value)
for sh in S.Settings.subSectionHe... | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 6f30002d0b09486e596bee1980a6b15aca725a1e | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/6f30002d0b09486e596bee1980a6b15aca725a1e/tools/settings.coffee | 79 | 90 | ||
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
applySectionHeadings = (force) ->
sv = document.querySelector('.settings-view')
for sh in S.Settings.sectionHeadings
el = getTextMatchElement(sv, '.section-heading', sh.label)
continue unless el
if !isAlreadyLocalized(el) and force
applyText... | var applySectionHeadings;
applySectionHeadings = function(force) {
var el, i, j, len, len1, ref, ref1, results, sh, sv;
sv = document.querySelector('.settings-view');
ref = S.Settings.sectionHeadings;
for (i = 0, len = ref.length; i < len; i++) {
sh = ref[i];
el = getTextMatchElement(sv, '.section-head... | CoffeeScript | JavaScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 6f30002d0b09486e596bee1980a6b15aca725a1e | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/6f30002d0b09486e596bee1980a6b15aca725a1e/tools/settings.coffee | 79 | 90 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var applySectionHeadings;
applySectionHeadings = function(force) {
var el, i, j, len, len1, ref, ref1, results, sh, sv;
sv = document.querySelector('.settings-view');
ref = S.Settings.sectionHeadings;
for (i = 0, len = ref.length; i < len; i++) {
sh = ... | applySectionHeadings = (force) ->
sv = document.querySelector('.settings-view')
for sh in S.Settings.sectionHeadings
el = getTextMatchElement(sv, '.section-heading', sh.label)
continue unless el
if !isAlreadyLocalized(el) and force
applyTextWithOrg(el, sh.value)
for sh in S.Settings.subSectionHe... | JavaScript | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 6f30002d0b09486e596bee1980a6b15aca725a1e | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/6f30002d0b09486e596bee1980a6b15aca725a1e/tools/settings.coffee | 79 | 90 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:5:completion | completion | applySectionHeadings = (force) ->
sv = document.querySelector('.settings-view')
for sh in S.Settings.sectionHeadings
el = getTextMatchElement(sv, '.section-heading', sh.label)
continue unless el
if !isAlreadyLocalized(el) and force | applyTextWithOrg(el, sh.value)
for sh in S.Settings.subSectionHeadings
el = getTextMatchElement(sv, '.sub-section-heading', sh.label)
continue unless el
if !isAlreadyLocalized(el) and force
applyTextWithOrg(el, sh.value) | CoffeeScript | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 6f30002d0b09486e596bee1980a6b15aca725a1e | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/6f30002d0b09486e596bee1980a6b15aca725a1e/tools/settings.coffee | 79 | 90 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:6:raw_corpus | raw_corpus | applyButtonToolbar = () ->
sv = document.querySelector('.settings-view')
for btn in sv.querySelectorAll('.meta-controls .install-button')
applyTextWithOrg(btn, "安装")
for btn in sv.querySelectorAll('.meta-controls .settings')
applyTextWithOrg(btn, "设置")
for btn in sv.querySelectorAll('.meta-controls .uni... | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 6f30002d0b09486e596bee1980a6b15aca725a1e | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/6f30002d0b09486e596bee1980a6b15aca725a1e/tools/settings.coffee | 92 | 103 | ||
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:6:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
applyButtonToolbar = () ->
sv = document.querySelector('.settings-view')
for btn in sv.querySelectorAll('.meta-controls .install-button')
applyTextWithOrg(btn, "安装")
for btn in sv.querySelectorAll('.meta-controls .settings')
applyTextWithOrg(btn, "设... | var applyButtonToolbar;
applyButtonToolbar = function() {
var btn, i, j, k, l, len, len1, len2, len3, len4, m, ref, ref1, ref2, ref3, ref4, results, sv;
sv = document.querySelector('.settings-view');
ref = sv.querySelectorAll('.meta-controls .install-button');
for (i = 0, len = ref.length; i < len; i++) {
... | CoffeeScript | JavaScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 6f30002d0b09486e596bee1980a6b15aca725a1e | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/6f30002d0b09486e596bee1980a6b15aca725a1e/tools/settings.coffee | 92 | 103 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:6:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var applyButtonToolbar;
applyButtonToolbar = function() {
var btn, i, j, k, l, len, len1, len2, len3, len4, m, ref, ref1, ref2, ref3, ref4, results, sv;
sv = document.querySelector('.settings-view');
ref = sv.querySelectorAll('.meta-controls .install-button'... | applyButtonToolbar = () ->
sv = document.querySelector('.settings-view')
for btn in sv.querySelectorAll('.meta-controls .install-button')
applyTextWithOrg(btn, "安装")
for btn in sv.querySelectorAll('.meta-controls .settings')
applyTextWithOrg(btn, "设置")
for btn in sv.querySelectorAll('.meta-controls .uni... | JavaScript | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 6f30002d0b09486e596bee1980a6b15aca725a1e | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/6f30002d0b09486e596bee1980a6b15aca725a1e/tools/settings.coffee | 92 | 103 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:6:completion | completion | applyButtonToolbar = () ->
sv = document.querySelector('.settings-view')
for btn in sv.querySelectorAll('.meta-controls .install-button')
applyTextWithOrg(btn, "安装")
for btn in sv.querySelectorAll('.meta-controls .settings')
applyTextWithOrg(btn, "设置") | for btn in sv.querySelectorAll('.meta-controls .uninstall-button')
applyTextWithOrg(btn, "卸载")
for btn in sv.querySelectorAll('.meta-controls .icon-playback-pause span')
applyTextWithOrg(btn, "关闭")
for btn in sv.querySelectorAll('.meta-controls .icon-playback-play span')
applyTextWithOrg(btn, "启用") | CoffeeScript | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 6f30002d0b09486e596bee1980a6b15aca725a1e | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/6f30002d0b09486e596bee1980a6b15aca725a1e/tools/settings.coffee | 92 | 103 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:7:raw_corpus | raw_corpus | getTextMatchElement = (area, query, text) ->
elems = area.querySelectorAll(query)
result
for el in elems
if el.textContent.includes(text)
result = el
break
return result | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 6f30002d0b09486e596bee1980a6b15aca725a1e | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/6f30002d0b09486e596bee1980a6b15aca725a1e/tools/settings.coffee | 105 | 112 | ||
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:7:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
getTextMatchElement = (area, query, text) ->
elems = area.querySelectorAll(query)
result
for el in elems
if el.textContent.includes(text)
result = el
break
return result
``` | var getTextMatchElement;
getTextMatchElement = function(area, query, text) {
var el, elems, i, len, result;
elems = area.querySelectorAll(query);
result;
for (i = 0, len = elems.length; i < len; i++) {
el = elems[i];
if (el.textContent.includes(text)) {
result = el;
break;
}
}
retur... | CoffeeScript | JavaScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 6f30002d0b09486e596bee1980a6b15aca725a1e | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/6f30002d0b09486e596bee1980a6b15aca725a1e/tools/settings.coffee | 105 | 112 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:7:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var getTextMatchElement;
getTextMatchElement = function(area, query, text) {
var el, elems, i, len, result;
elems = area.querySelectorAll(query);
result;
for (i = 0, len = elems.length; i < len; i++) {
el = elems[i];
if (el.textContent.includes(tex... | getTextMatchElement = (area, query, text) ->
elems = area.querySelectorAll(query)
result
for el in elems
if el.textContent.includes(text)
result = el
break
return result | JavaScript | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 6f30002d0b09486e596bee1980a6b15aca725a1e | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/6f30002d0b09486e596bee1980a6b15aca725a1e/tools/settings.coffee | 105 | 112 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:7:completion | completion | getTextMatchElement = (area, query, text) ->
elems = area.querySelectorAll(query)
result
for el in elems | if el.textContent.includes(text)
result = el
break
return result | CoffeeScript | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 6f30002d0b09486e596bee1980a6b15aca725a1e | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/6f30002d0b09486e596bee1980a6b15aca725a1e/tools/settings.coffee | 105 | 112 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:8:raw_corpus | raw_corpus | isAlreadyLocalized = (elem) ->
localized = elem.getAttribute('data-localized') if elem
return localized is 'true' | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 6f30002d0b09486e596bee1980a6b15aca725a1e | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/6f30002d0b09486e596bee1980a6b15aca725a1e/tools/settings.coffee | 114 | 116 | ||
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:8:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
isAlreadyLocalized = (elem) ->
localized = elem.getAttribute('data-localized') if elem
return localized is 'true'
``` | var isAlreadyLocalized;
isAlreadyLocalized = function(elem) {
var localized;
if (elem) {
localized = elem.getAttribute('data-localized');
}
return localized === 'true';
}; | CoffeeScript | JavaScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 6f30002d0b09486e596bee1980a6b15aca725a1e | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/6f30002d0b09486e596bee1980a6b15aca725a1e/tools/settings.coffee | 114 | 116 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:8:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var isAlreadyLocalized;
isAlreadyLocalized = function(elem) {
var localized;
if (elem) {
localized = elem.getAttribute('data-localized');
}
return localized === 'true';
};
``` | isAlreadyLocalized = (elem) ->
localized = elem.getAttribute('data-localized') if elem
return localized is 'true' | JavaScript | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 6f30002d0b09486e596bee1980a6b15aca725a1e | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/6f30002d0b09486e596bee1980a6b15aca725a1e/tools/settings.coffee | 114 | 116 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:9:raw_corpus | raw_corpus | applyTextContentBySettingsId = (data) ->
el = document.querySelector("[id='#{data.id}']")
return unless el
ctrl = el.closest('.control-group')
applyTextWithOrg(ctrl.querySelector('.setting-title'), data.title)
applyTextWithOrg(ctrl.querySelector('.setting-description'), data.desc) | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 6f30002d0b09486e596bee1980a6b15aca725a1e | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/6f30002d0b09486e596bee1980a6b15aca725a1e/tools/settings.coffee | 118 | 123 | ||
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:9:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
applyTextContentBySettingsId = (data) ->
el = document.querySelector("[id='#{data.id}']")
return unless el
ctrl = el.closest('.control-group')
applyTextWithOrg(ctrl.querySelector('.setting-title'), data.title)
applyTextWithOrg(ctrl.querySelector('.setti... | var applyTextContentBySettingsId;
applyTextContentBySettingsId = function(data) {
var ctrl, el;
el = document.querySelector(`[id='${data.id}']`);
if (!el) {
return;
}
ctrl = el.closest('.control-group');
applyTextWithOrg(ctrl.querySelector('.setting-title'), data.title);
return applyTextWithOrg(ctrl.... | CoffeeScript | JavaScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 6f30002d0b09486e596bee1980a6b15aca725a1e | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/6f30002d0b09486e596bee1980a6b15aca725a1e/tools/settings.coffee | 118 | 123 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:9:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var applyTextContentBySettingsId;
applyTextContentBySettingsId = function(data) {
var ctrl, el;
el = document.querySelector(`[id='${data.id}']`);
if (!el) {
return;
}
ctrl = el.closest('.control-group');
applyTextWithOrg(ctrl.querySelector('.settin... | applyTextContentBySettingsId = (data) ->
el = document.querySelector("[id='#{data.id}']")
return unless el
ctrl = el.closest('.control-group')
applyTextWithOrg(ctrl.querySelector('.setting-title'), data.title)
applyTextWithOrg(ctrl.querySelector('.setting-description'), data.desc) | JavaScript | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 6f30002d0b09486e596bee1980a6b15aca725a1e | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/6f30002d0b09486e596bee1980a6b15aca725a1e/tools/settings.coffee | 118 | 123 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:9:completion | completion | applyTextContentBySettingsId = (data) ->
el = document.querySelector("[id='#{data.id}']")
return unless el | ctrl = el.closest('.control-group')
applyTextWithOrg(ctrl.querySelector('.setting-title'), data.title)
applyTextWithOrg(ctrl.querySelector('.setting-description'), data.desc) | CoffeeScript | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 6f30002d0b09486e596bee1980a6b15aca725a1e | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/6f30002d0b09486e596bee1980a6b15aca725a1e/tools/settings.coffee | 118 | 123 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:10:raw_corpus | raw_corpus | applyTextWithOrg = (elem, text) ->
return unless text
before = String(elem.textContent)
return if before is text
elem.textContent = text
elem.setAttribute('title', before)
elem.setAttribute('data-localized', 'true') | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 6f30002d0b09486e596bee1980a6b15aca725a1e | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/6f30002d0b09486e596bee1980a6b15aca725a1e/tools/settings.coffee | 125 | 131 | ||
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:10:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
applyTextWithOrg = (elem, text) ->
return unless text
before = String(elem.textContent)
return if before is text
elem.textContent = text
elem.setAttribute('title', before)
elem.setAttribute('data-localized', 'true')
``` | var applyTextWithOrg;
applyTextWithOrg = function(elem, text) {
var before;
if (!text) {
return;
}
before = String(elem.textContent);
if (before === text) {
return;
}
elem.textContent = text;
elem.setAttribute('title', before);
return elem.setAttribute('data-localized', 'true');
}; | CoffeeScript | JavaScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 6f30002d0b09486e596bee1980a6b15aca725a1e | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/6f30002d0b09486e596bee1980a6b15aca725a1e/tools/settings.coffee | 125 | 131 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:10:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var applyTextWithOrg;
applyTextWithOrg = function(elem, text) {
var before;
if (!text) {
return;
}
before = String(elem.textContent);
if (before === text) {
return;
}
elem.textContent = text;
elem.setAttribute('title', before);
return ele... | applyTextWithOrg = (elem, text) ->
return unless text
before = String(elem.textContent)
return if before is text
elem.textContent = text
elem.setAttribute('title', before)
elem.setAttribute('data-localized', 'true') | JavaScript | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 6f30002d0b09486e596bee1980a6b15aca725a1e | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/6f30002d0b09486e596bee1980a6b15aca725a1e/tools/settings.coffee | 125 | 131 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:10:completion | completion | applyTextWithOrg = (elem, text) ->
return unless text
before = String(elem.textContent) | return if before is text
elem.textContent = text
elem.setAttribute('title', before)
elem.setAttribute('data-localized', 'true') | CoffeeScript | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 6f30002d0b09486e596bee1980a6b15aca725a1e | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/6f30002d0b09486e596bee1980a6b15aca725a1e/tools/settings.coffee | 125 | 131 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:11:raw_corpus | raw_corpus | Settings =
init : () ->
settingsTab = document.querySelector('.tab-bar [data-type="SettingsView"]')
settingsEnabled = settingsTab.className.includes 'active' if settingsTab
return unless settingsTab && settingsEnabled
try
# Tab title
# settingsTab.querySelector('.title').textContent = "设置"... | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 6f30002d0b09486e596bee1980a6b15aca725a1e | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/6f30002d0b09486e596bee1980a6b15aca725a1e/tools/settings.coffee | 134 | 182 | ||
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:11:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Settings =
init : () ->
settingsTab = document.querySelector('.tab-bar [data-type="SettingsView"]')
settingsEnabled = settingsTab.className.includes 'active' if settingsTab
return unless settingsTab && settingsEnabled
try
# Tab title
... | var Settings;
Settings = {
init: function() {
var btn, btns, d, e, el, ext, font, i, j, k, lastMenu, len, len1, len2, menu, panelMenus, pm, ref, results, settingsEnabled, settingsTab, sv;
settingsTab = document.querySelector('.tab-bar [data-type="SettingsView"]');
if (settingsTab) {
settingsEnabled... | CoffeeScript | JavaScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 6f30002d0b09486e596bee1980a6b15aca725a1e | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/6f30002d0b09486e596bee1980a6b15aca725a1e/tools/settings.coffee | 134 | 182 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:11:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Settings;
Settings = {
init: function() {
var btn, btns, d, e, el, ext, font, i, j, k, lastMenu, len, len1, len2, menu, panelMenus, pm, ref, results, settingsEnabled, settingsTab, sv;
settingsTab = document.querySelector('.tab-bar [data-type="Setting... | Settings =
init : () ->
settingsTab = document.querySelector('.tab-bar [data-type="SettingsView"]')
settingsEnabled = settingsTab.className.includes 'active' if settingsTab
return unless settingsTab && settingsEnabled
try
# Tab title
# settingsTab.querySelector('.title').textContent = "设置"... | JavaScript | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 6f30002d0b09486e596bee1980a6b15aca725a1e | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/6f30002d0b09486e596bee1980a6b15aca725a1e/tools/settings.coffee | 134 | 182 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:11:completion | completion | Settings =
init : () ->
settingsTab = document.querySelector('.tab-bar [data-type="SettingsView"]')
settingsEnabled = settingsTab.className.includes 'active' if settingsTab
return unless settingsTab && settingsEnabled
try
# Tab title
# settingsTab.querySelector('.title').textContent = "设置"... | pm.addEventListener('click', applyInstallPanelOnSwitch)
# Restore last active menu
lastMenu.click() if lastMenu
# on Init
applyToPanel()
# Left-side menu
menu = sv.querySelector('.settings-view .panels-menu')
return unless menu
for d in S.Settings.menu
el = menu... | CoffeeScript | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 6f30002d0b09486e596bee1980a6b15aca725a1e | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/6f30002d0b09486e596bee1980a6b15aca725a1e/tools/settings.coffee | 134 | 182 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:5:raw_corpus | raw_corpus | applySectionHeadings = (force) ->
sv = document.querySelector('.settings-view')
for sh in S.Settings.sectionHeadings
el = getTextMatchElement(sv, '.section-heading', sh.label)
continue unless el
if !isAlreadyLocalized(el) || force
applyTextWithOrg(el, sh.value)
for sh in S.Settings.subSectionHea... | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 77aed9512773d6352c67a1ce8c20bbb7cc9f3ba8 | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/77aed9512773d6352c67a1ce8c20bbb7cc9f3ba8/tools/settings.coffee | 79 | 90 | ||
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
applySectionHeadings = (force) ->
sv = document.querySelector('.settings-view')
for sh in S.Settings.sectionHeadings
el = getTextMatchElement(sv, '.section-heading', sh.label)
continue unless el
if !isAlreadyLocalized(el) || force
applyTextW... | var applySectionHeadings;
applySectionHeadings = function(force) {
var el, i, j, len, len1, ref, ref1, results, sh, sv;
sv = document.querySelector('.settings-view');
ref = S.Settings.sectionHeadings;
for (i = 0, len = ref.length; i < len; i++) {
sh = ref[i];
el = getTextMatchElement(sv, '.section-head... | CoffeeScript | JavaScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 77aed9512773d6352c67a1ce8c20bbb7cc9f3ba8 | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/77aed9512773d6352c67a1ce8c20bbb7cc9f3ba8/tools/settings.coffee | 79 | 90 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var applySectionHeadings;
applySectionHeadings = function(force) {
var el, i, j, len, len1, ref, ref1, results, sh, sv;
sv = document.querySelector('.settings-view');
ref = S.Settings.sectionHeadings;
for (i = 0, len = ref.length; i < len; i++) {
sh = ... | applySectionHeadings = (force) ->
sv = document.querySelector('.settings-view')
for sh in S.Settings.sectionHeadings
el = getTextMatchElement(sv, '.section-heading', sh.label)
continue unless el
if !isAlreadyLocalized(el) || force
applyTextWithOrg(el, sh.value)
for sh in S.Settings.subSectionHea... | JavaScript | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 77aed9512773d6352c67a1ce8c20bbb7cc9f3ba8 | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/77aed9512773d6352c67a1ce8c20bbb7cc9f3ba8/tools/settings.coffee | 79 | 90 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:5:completion | completion | applySectionHeadings = (force) ->
sv = document.querySelector('.settings-view')
for sh in S.Settings.sectionHeadings
el = getTextMatchElement(sv, '.section-heading', sh.label)
continue unless el
if !isAlreadyLocalized(el) || force | applyTextWithOrg(el, sh.value)
for sh in S.Settings.subSectionHeadings
el = getTextMatchElement(sv, '.sub-section-heading', sh.label)
continue unless el
if !isAlreadyLocalized(el) || force
applyTextWithOrg(el, sh.value) | CoffeeScript | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 77aed9512773d6352c67a1ce8c20bbb7cc9f3ba8 | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/77aed9512773d6352c67a1ce8c20bbb7cc9f3ba8/tools/settings.coffee | 79 | 90 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:8:raw_corpus | raw_corpus | isAlreadyLocalized = (elem) ->
localized = elem.getAttribute('data-localized') if elem
return localized == 'true' | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 77aed9512773d6352c67a1ce8c20bbb7cc9f3ba8 | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/77aed9512773d6352c67a1ce8c20bbb7cc9f3ba8/tools/settings.coffee | 114 | 116 | ||
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:8:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
isAlreadyLocalized = (elem) ->
localized = elem.getAttribute('data-localized') if elem
return localized == 'true'
``` | var isAlreadyLocalized;
isAlreadyLocalized = function(elem) {
var localized;
if (elem) {
localized = elem.getAttribute('data-localized');
}
return localized === 'true';
}; | CoffeeScript | JavaScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 77aed9512773d6352c67a1ce8c20bbb7cc9f3ba8 | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/77aed9512773d6352c67a1ce8c20bbb7cc9f3ba8/tools/settings.coffee | 114 | 116 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:8:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var isAlreadyLocalized;
isAlreadyLocalized = function(elem) {
var localized;
if (elem) {
localized = elem.getAttribute('data-localized');
}
return localized === 'true';
};
``` | isAlreadyLocalized = (elem) ->
localized = elem.getAttribute('data-localized') if elem
return localized == 'true' | JavaScript | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 77aed9512773d6352c67a1ce8c20bbb7cc9f3ba8 | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/77aed9512773d6352c67a1ce8c20bbb7cc9f3ba8/tools/settings.coffee | 114 | 116 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:10:raw_corpus | raw_corpus | applyTextWithOrg = (elem, text) ->
return unless text
before = String(elem.textContent)
return if before == text
elem.textContent = text
elem.setAttribute('title', before)
elem.setAttribute('data-localized', 'true') | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 77aed9512773d6352c67a1ce8c20bbb7cc9f3ba8 | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/77aed9512773d6352c67a1ce8c20bbb7cc9f3ba8/tools/settings.coffee | 125 | 131 | ||
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:10:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
applyTextWithOrg = (elem, text) ->
return unless text
before = String(elem.textContent)
return if before == text
elem.textContent = text
elem.setAttribute('title', before)
elem.setAttribute('data-localized', 'true')
``` | var applyTextWithOrg;
applyTextWithOrg = function(elem, text) {
var before;
if (!text) {
return;
}
before = String(elem.textContent);
if (before === text) {
return;
}
elem.textContent = text;
elem.setAttribute('title', before);
return elem.setAttribute('data-localized', 'true');
}; | CoffeeScript | JavaScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 77aed9512773d6352c67a1ce8c20bbb7cc9f3ba8 | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/77aed9512773d6352c67a1ce8c20bbb7cc9f3ba8/tools/settings.coffee | 125 | 131 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:10:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var applyTextWithOrg;
applyTextWithOrg = function(elem, text) {
var before;
if (!text) {
return;
}
before = String(elem.textContent);
if (before === text) {
return;
}
elem.textContent = text;
elem.setAttribute('title', before);
return ele... | applyTextWithOrg = (elem, text) ->
return unless text
before = String(elem.textContent)
return if before == text
elem.textContent = text
elem.setAttribute('title', before)
elem.setAttribute('data-localized', 'true') | JavaScript | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 77aed9512773d6352c67a1ce8c20bbb7cc9f3ba8 | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/77aed9512773d6352c67a1ce8c20bbb7cc9f3ba8/tools/settings.coffee | 125 | 131 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:10:completion | completion | applyTextWithOrg = (elem, text) ->
return unless text
before = String(elem.textContent) | return if before == text
elem.textContent = text
elem.setAttribute('title', before)
elem.setAttribute('data-localized', 'true') | CoffeeScript | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 77aed9512773d6352c67a1ce8c20bbb7cc9f3ba8 | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/77aed9512773d6352c67a1ce8c20bbb7cc9f3ba8/tools/settings.coffee | 125 | 131 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:11:raw_corpus | raw_corpus | Settings =
init : () ->
settingsTab = document.querySelector('.tab-bar [data-type="SettingsView"]')
settingsEnabled = settingsTab.className.includes 'active' if settingsTab
return unless settingsTab && settingsEnabled
try
# Tab title
# settingsTab.querySelector('.title').textContent = "设置"... | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 77aed9512773d6352c67a1ce8c20bbb7cc9f3ba8 | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/77aed9512773d6352c67a1ce8c20bbb7cc9f3ba8/tools/settings.coffee | 134 | 182 | ||
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:11:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Settings =
init : () ->
settingsTab = document.querySelector('.tab-bar [data-type="SettingsView"]')
settingsEnabled = settingsTab.className.includes 'active' if settingsTab
return unless settingsTab && settingsEnabled
try
# Tab title
... | var Settings;
Settings = {
init: function() {
var btn, btns, d, e, el, ext, i, j, k, lastMenu, len, len1, len2, menu, panelMenus, pm, ref, results, settingsEnabled, settingsTab, sv;
settingsTab = document.querySelector('.tab-bar [data-type="SettingsView"]');
if (settingsTab) {
settingsEnabled = set... | CoffeeScript | JavaScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 77aed9512773d6352c67a1ce8c20bbb7cc9f3ba8 | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/77aed9512773d6352c67a1ce8c20bbb7cc9f3ba8/tools/settings.coffee | 134 | 182 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:11:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Settings;
Settings = {
init: function() {
var btn, btns, d, e, el, ext, i, j, k, lastMenu, len, len1, len2, menu, panelMenus, pm, ref, results, settingsEnabled, settingsTab, sv;
settingsTab = document.querySelector('.tab-bar [data-type="SettingsView"... | Settings =
init : () ->
settingsTab = document.querySelector('.tab-bar [data-type="SettingsView"]')
settingsEnabled = settingsTab.className.includes 'active' if settingsTab
return unless settingsTab && settingsEnabled
try
# Tab title
# settingsTab.querySelector('.title').textContent = "设置"... | JavaScript | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 77aed9512773d6352c67a1ce8c20bbb7cc9f3ba8 | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/77aed9512773d6352c67a1ce8c20bbb7cc9f3ba8/tools/settings.coffee | 134 | 182 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:11:completion | completion | Settings =
init : () ->
settingsTab = document.querySelector('.tab-bar [data-type="SettingsView"]')
settingsEnabled = settingsTab.className.includes 'active' if settingsTab
return unless settingsTab && settingsEnabled
try
# Tab title
# settingsTab.querySelector('.title').textContent = "设置"... | pm.addEventListener('click', applyInstallPanelOnSwitch)
# Restore last active menu
lastMenu.click() if lastMenu
# on Init
applyToPanel()
# Left-side menu
menu = sv.querySelector('.settings-view .panels-menu')
return unless menu
for d in S.Settings.menu
el = menu... | CoffeeScript | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 77aed9512773d6352c67a1ce8c20bbb7cc9f3ba8 | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/77aed9512773d6352c67a1ce8c20bbb7cc9f3ba8/tools/settings.coffee | 134 | 182 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:11:raw_corpus | raw_corpus | settings =
init : () ->
settingsTab = document.querySelector('.tab-bar [data-type="SettingsView"]')
settingsEnabled = settingsTab.className.includes 'active' if settingsTab
return unless settingsTab && settingsEnabled
try
console.log 'try'
# Tab title
settingsTab.querySelector('.titl... | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | c3720eb9c5cc3e3cb78d3a35e3f8eb2a578c0e0b | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/c3720eb9c5cc3e3cb78d3a35e3f8eb2a578c0e0b/tools/settings.coffee | 134 | 183 | ||
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:11:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
settings =
init : () ->
settingsTab = document.querySelector('.tab-bar [data-type="SettingsView"]')
settingsEnabled = settingsTab.className.includes 'active' if settingsTab
return unless settingsTab && settingsEnabled
try
console.log 'try'... | var settings;
settings = {
init: function() {
var btn, btns, d, e, el, ext, font, i, j, k, lastMenu, len, len1, len2, menu, panelMenus, pm, ref, results, settingsEnabled, settingsTab, sv;
settingsTab = document.querySelector('.tab-bar [data-type="SettingsView"]');
if (settingsTab) {
settingsEnabled... | CoffeeScript | JavaScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | c3720eb9c5cc3e3cb78d3a35e3f8eb2a578c0e0b | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/c3720eb9c5cc3e3cb78d3a35e3f8eb2a578c0e0b/tools/settings.coffee | 134 | 183 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:11:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var settings;
settings = {
init: function() {
var btn, btns, d, e, el, ext, font, i, j, k, lastMenu, len, len1, len2, menu, panelMenus, pm, ref, results, settingsEnabled, settingsTab, sv;
settingsTab = document.querySelector('.tab-bar [data-type="Setting... | settings =
init : () ->
settingsTab = document.querySelector('.tab-bar [data-type="SettingsView"]')
settingsEnabled = settingsTab.className.includes 'active' if settingsTab
return unless settingsTab && settingsEnabled
try
console.log 'try'
# Tab title
settingsTab.querySelector('.titl... | JavaScript | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | c3720eb9c5cc3e3cb78d3a35e3f8eb2a578c0e0b | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/c3720eb9c5cc3e3cb78d3a35e3f8eb2a578c0e0b/tools/settings.coffee | 134 | 183 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:11:completion | completion | settings =
init : () ->
settingsTab = document.querySelector('.tab-bar [data-type="SettingsView"]')
settingsEnabled = settingsTab.className.includes 'active' if settingsTab
return unless settingsTab && settingsEnabled
try
console.log 'try'
# Tab title
settingsTab.querySelector('.titl... | pm.addEventListener('click', applyInstallPanelOnSwitch)
# Restore last active menu
lastMenu.click() if lastMenu
# on Init
applyToPanel()
# Left-side menu
menu = sv.querySelector('.settings-view .panels-menu')
return unless menu
for d in S.Settings.menu
el = menu... | CoffeeScript | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | c3720eb9c5cc3e3cb78d3a35e3f8eb2a578c0e0b | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/c3720eb9c5cc3e3cb78d3a35e3f8eb2a578c0e0b/tools/settings.coffee | 134 | 183 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:1:raw_corpus | raw_corpus | applyToPanel = (e) ->
# Settings panel
for d in S.Settings.settings
applyTextContentBySettingsId(d)
sv = document.querySelector('.settings-view')
# Keybindings
info = sv.querySelector('.keybinding-panel>div:nth-child(2)')
unless isAlreadyLocalized(info)
info.querySelector('span:nth-child(2)').text... | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 2f40468b616ec529efa999e725f8c6f3dc8245f7 | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/2f40468b616ec529efa999e725f8c6f3dc8245f7/tools/settings.coffee | 5 | 54 | ||
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
applyToPanel = (e) ->
# Settings panel
for d in S.Settings.settings
applyTextContentBySettingsId(d)
sv = document.querySelector('.settings-view')
# Keybindings
info = sv.querySelector('.keybinding-panel>div:nth-child(2)')
unless isAlreadyLocaliz... | var applyToPanel;
applyToPanel = function(e) {
var d, i, info, inst, len, ref, span, sv, tc, tp1, tp2;
ref = S.Settings.settings;
// Settings panel
for (i = 0, len = ref.length; i < len; i++) {
d = ref[i];
applyTextContentBySettingsId(d);
}
sv = document.querySelector('.settings-view');
// Keybin... | CoffeeScript | JavaScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 2f40468b616ec529efa999e725f8c6f3dc8245f7 | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/2f40468b616ec529efa999e725f8c6f3dc8245f7/tools/settings.coffee | 5 | 54 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var applyToPanel;
applyToPanel = function(e) {
var d, i, info, inst, len, ref, span, sv, tc, tp1, tp2;
ref = S.Settings.settings;
// Settings panel
for (i = 0, len = ref.length; i < len; i++) {
d = ref[i];
applyTextContentBySettingsId(d);
}
sv ... | applyToPanel = (e) ->
# Settings panel
for d in S.Settings.settings
applyTextContentBySettingsId(d)
sv = document.querySelector('.settings-view')
# Keybindings
info = sv.querySelector('.keybinding-panel>div:nth-child(2)')
unless isAlreadyLocalized(info)
info.querySelector('span:nth-child(2)').text... | JavaScript | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 2f40468b616ec529efa999e725f8c6f3dc8245f7 | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/2f40468b616ec529efa999e725f8c6f3dc8245f7/tools/settings.coffee | 5 | 54 |
chinakids/atom-simplified-chinese-menu:tools/settings.coffee:1:completion | completion | applyToPanel = (e) ->
# Settings panel
for d in S.Settings.settings
applyTextContentBySettingsId(d)
sv = document.querySelector('.settings-view')
# Keybindings
info = sv.querySelector('.keybinding-panel>div:nth-child(2)')
unless isAlreadyLocalized(info)
info.querySelector('span:nth-child(2)').text... | # console.log info
info.appendChild(span)
tp1 = sv.querySelector('.themes-picker>div:nth-child(1)')
tp1.querySelector('.setting-title').textContent = "UI 主题"
tp1.querySelector('.setting-description').textContent = "该主题将应用在标签,状态栏,树形视图和下拉菜单等。"
tp2 = sv.querySelector('.themes-picker>div:nth-child(2)')
... | CoffeeScript | CoffeeScript | chinakids/atom-simplified-chinese-menu | tools/settings.coffee | MIT | 2f40468b616ec529efa999e725f8c6f3dc8245f7 | 1,335 | https://github.com/chinakids/atom-simplified-chinese-menu/blob/2f40468b616ec529efa999e725f8c6f3dc8245f7/tools/settings.coffee | 5 | 54 |
cdglabs/apparatus:src/View/CreatePanel.coffee:1:raw_corpus | raw_corpus | _ = require "underscore"
R = require "./R"
Model = require "../Model/Model"
Util = require "../Util/Util"
R.create "CreatePanel",
contextTypes:
project: Model.Project
editor: Model.Editor
render: ->
project = @context.project
layout = @context.editor.layout
if layout.fullScreen
return ... | CoffeeScript | cdglabs/apparatus | src/View/CreatePanel.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/View/CreatePanel.coffee | 1 | 42 | ||
cdglabs/apparatus:src/View/CreatePanel.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_ = require "underscore"
R = require "./R"
Model = require "../Model/Model"
Util = require "../Util/Util"
R.create "CreatePanel",
contextTypes:
project: Model.Project
editor: Model.Editor
render: ->
project = @context.project
layout = @cont... | var Model, R, Util, _;
_ = require("underscore");
R = require("./R");
Model = require("../Model/Model");
Util = require("../Util/Util");
R.create("CreatePanel", {
contextTypes: {
project: Model.Project,
editor: Model.Editor
},
render: function() {
var element, layout, project;
project = this.... | CoffeeScript | JavaScript | cdglabs/apparatus | src/View/CreatePanel.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/View/CreatePanel.coffee | 1 | 42 |
cdglabs/apparatus:src/View/CreatePanel.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Model, R, Util, _;
_ = require("underscore");
R = require("./R");
Model = require("../Model/Model");
Util = require("../Util/Util");
R.create("CreatePanel", {
contextTypes: {
project: Model.Project,
editor: Model.Editor
},
render: function() ... | _ = require "underscore"
R = require "./R"
Model = require "../Model/Model"
Util = require "../Util/Util"
R.create "CreatePanel",
contextTypes:
project: Model.Project
editor: Model.Editor
render: ->
project = @context.project
layout = @context.editor.layout
if layout.fullScreen
return ... | JavaScript | CoffeeScript | cdglabs/apparatus | src/View/CreatePanel.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/View/CreatePanel.coffee | 1 | 42 |
cdglabs/apparatus:src/View/CreatePanel.coffee:1:completion | completion | _ = require "underscore"
R = require "./R"
Model = require "../Model/Model"
Util = require "../Util/Util"
R.create "CreatePanel",
contextTypes:
project: Model.Project
editor: Model.Editor
render: ->
project = @context.project
layout = @context.editor.layout
if layout.fullScreen
return ... | R.div {className: "Scroller"},
for element in project.createPanelElements
R.CreatePanelItem {element, key: Util.getId(element)}
R.div {className: "CreatePanelAddItem"},
R.button {
className: "AddButton",
onClick: @_createNewElement
}
... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/View/CreatePanel.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/View/CreatePanel.coffee | 1 | 42 |
cdglabs/apparatus:src/View/CreatePanel.coffee:2:raw_corpus | raw_corpus | propTypes:
element: Model.Element
render: ->
element = @props.element
R.div {
className: R.cx {
"CreatePanelItem": true
"isEditing": @_isEditing()
}
},
R.div {
className: "CreatePanelThumbnail"
onMouseDown: @_onMouseDown
},
R.ThumbnailCa... | CoffeeScript | cdglabs/apparatus | src/View/CreatePanel.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/View/CreatePanel.coffee | 44 | 84 | ||
cdglabs/apparatus:src/View/CreatePanel.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
propTypes:
element: Model.Element
render: ->
element = @props.element
R.div {
className: R.cx {
"CreatePanelItem": true
"isEditing": @_isEditing()
}
},
R.div {
className: "CreatePanelThumbnail"
... | ({
propTypes: {
element: Model.Element
},
render: function() {
var element;
element = this.props.element;
return R.div({
className: R.cx({
"CreatePanelItem": true,
"isEditing": this._isEditing()
})
}, R.div({
className: "CreatePanelThumbnail",
onMouseDow... | CoffeeScript | JavaScript | cdglabs/apparatus | src/View/CreatePanel.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/View/CreatePanel.coffee | 44 | 84 |
cdglabs/apparatus:src/View/CreatePanel.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
propTypes: {
element: Model.Element
},
render: function() {
var element;
element = this.props.element;
return R.div({
className: R.cx({
"CreatePanelItem": true,
"isEditing": this._isEditing()
})
}, R.div({
... | propTypes:
element: Model.Element
render: ->
element = @props.element
R.div {
className: R.cx {
"CreatePanelItem": true
"isEditing": @_isEditing()
}
},
R.div {
className: "CreatePanelThumbnail"
onMouseDown: @_onMouseDown
},
R.ThumbnailCa... | JavaScript | CoffeeScript | cdglabs/apparatus | src/View/CreatePanel.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/View/CreatePanel.coffee | 44 | 84 |
cdglabs/apparatus:src/View/CreatePanel.coffee:2:completion | completion | propTypes:
element: Model.Element
render: ->
element = @props.element
R.div {
className: R.cx {
"CreatePanelItem": true
"isEditing": @_isEditing()
}
},
R.div {
className: "CreatePanelThumbnail"
onMouseDown: @_onMouseDown
},
R.ThumbnailCa... | className: "CreatePanelItemEditButton icon-pencil"
onClick: @_editElement
}
if @_isEditable() and !@_isEditing()
R.div {
className: "CreatePanelItemRemoveButton icon-x"
onClick: @_remove
}
R.div {
className: "CreatePanelLabel"
... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/View/CreatePanel.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/View/CreatePanel.coffee | 44 | 84 |
cdglabs/apparatus:src/View/CreatePanel.coffee:3:raw_corpus | raw_corpus | _isEditable: ->
{element} = @props
builtIn = _.values(Model)
return !_.contains(builtIn, element)
_setLabelValue: (newValue) ->
@props.element.label = newValue
_editElement: ->
{element} = @props
{project} = @context
project.setEditing(element)
_remove: ->
{element} = @props
... | CoffeeScript | cdglabs/apparatus | src/View/CreatePanel.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/View/CreatePanel.coffee | 86 | 117 | ||
cdglabs/apparatus:src/View/CreatePanel.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_isEditable: ->
{element} = @props
builtIn = _.values(Model)
return !_.contains(builtIn, element)
_setLabelValue: (newValue) ->
@props.element.label = newValue
_editElement: ->
{element} = @props
{project} = @context
project.setE... | ({
_isEditable: function() {
var builtIn, element;
({element} = this.props);
builtIn = _.values(Model);
return !_.contains(builtIn, element);
},
_setLabelValue: function(newValue) {
return this.props.element.label = newValue;
},
_editElement: function() {
var element, project;
({el... | CoffeeScript | JavaScript | cdglabs/apparatus | src/View/CreatePanel.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/View/CreatePanel.coffee | 86 | 117 |
cdglabs/apparatus:src/View/CreatePanel.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
_isEditable: function() {
var builtIn, element;
({element} = this.props);
builtIn = _.values(Model);
return !_.contains(builtIn, element);
},
_setLabelValue: function(newValue) {
return this.props.element.label = newValue;
},
_editE... | _isEditable: ->
{element} = @props
builtIn = _.values(Model)
return !_.contains(builtIn, element)
_setLabelValue: (newValue) ->
@props.element.label = newValue
_editElement: ->
{element} = @props
{project} = @context
project.setEditing(element)
_remove: ->
{element} = @props
... | JavaScript | CoffeeScript | cdglabs/apparatus | src/View/CreatePanel.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/View/CreatePanel.coffee | 86 | 117 |
cdglabs/apparatus:src/View/CreatePanel.coffee:3:completion | completion | _isEditable: ->
{element} = @props
builtIn = _.values(Model)
return !_.contains(builtIn, element)
_setLabelValue: (newValue) ->
@props.element.label = newValue
_editElement: ->
{element} = @props
{project} = @context
project.setEditing(element)
_remove: ->
{element} = @props
... | project.createPanelElements = _.without(project.createPanelElements, element)
_onMouseDown: (mouseDownEvent) ->
{dragManager} = @context
{element} = @props
mouseDownEvent.preventDefault()
Util.clearTextFocus()
dragManager.start mouseDownEvent,
type: "createElement"
element: element
... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/View/CreatePanel.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/View/CreatePanel.coffee | 86 | 117 |
cdglabs/apparatus:src/View/CreatePanel.coffee:1:raw_corpus | raw_corpus | _ = require "underscore"
R = require "./R"
Model = require "../Model/Model"
Util = require "../Util/Util"
R.create "CreatePanel",
contextTypes:
project: Model.Project
editor: Model.Editor
render: ->
project = @context.project
layout = @context.editor.layout
if layout.fullScreen
return ... | CoffeeScript | cdglabs/apparatus | src/View/CreatePanel.coffee | MIT | c2564482c7207389c163d3f99ccf564d0eae351a | 1,052 | https://github.com/cdglabs/apparatus/blob/c2564482c7207389c163d3f99ccf564d0eae351a/src/View/CreatePanel.coffee | 1 | 42 | ||
cdglabs/apparatus:src/View/CreatePanel.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_ = require "underscore"
R = require "./R"
Model = require "../Model/Model"
Util = require "../Util/Util"
R.create "CreatePanel",
contextTypes:
project: Model.Project
editor: Model.Editor
render: ->
project = @context.project
layout = @cont... | var Model, R, Util, _;
_ = require("underscore");
R = require("./R");
Model = require("../Model/Model");
Util = require("../Util/Util");
R.create("CreatePanel", {
contextTypes: {
project: Model.Project,
editor: Model.Editor
},
render: function() {
var element, layout, project;
project = this.... | CoffeeScript | JavaScript | cdglabs/apparatus | src/View/CreatePanel.coffee | MIT | c2564482c7207389c163d3f99ccf564d0eae351a | 1,052 | https://github.com/cdglabs/apparatus/blob/c2564482c7207389c163d3f99ccf564d0eae351a/src/View/CreatePanel.coffee | 1 | 42 |
cdglabs/apparatus:src/View/CreatePanel.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Model, R, Util, _;
_ = require("underscore");
R = require("./R");
Model = require("../Model/Model");
Util = require("../Util/Util");
R.create("CreatePanel", {
contextTypes: {
project: Model.Project,
editor: Model.Editor
},
render: function() ... | _ = require "underscore"
R = require "./R"
Model = require "../Model/Model"
Util = require "../Util/Util"
R.create "CreatePanel",
contextTypes:
project: Model.Project
editor: Model.Editor
render: ->
project = @context.project
layout = @context.editor.layout
if layout.fullScreen
return ... | JavaScript | CoffeeScript | cdglabs/apparatus | src/View/CreatePanel.coffee | MIT | c2564482c7207389c163d3f99ccf564d0eae351a | 1,052 | https://github.com/cdglabs/apparatus/blob/c2564482c7207389c163d3f99ccf564d0eae351a/src/View/CreatePanel.coffee | 1 | 42 |
cdglabs/apparatus:src/View/CreatePanel.coffee:1:completion | completion | _ = require "underscore"
R = require "./R"
Model = require "../Model/Model"
Util = require "../Util/Util"
R.create "CreatePanel",
contextTypes:
project: Model.Project
editor: Model.Editor
render: ->
project = @context.project
layout = @context.editor.layout
if layout.fullScreen
return ... | R.div {className: "Scroller"},
for element in project.createPanelElements
R.CreatePanelItem {element, key: Util.getId(element)}
R.div {className: "CreatePanelAddItem"},
R.button {
className: "AddButton",
onClick: @_createNewElement
}
... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/View/CreatePanel.coffee | MIT | c2564482c7207389c163d3f99ccf564d0eae351a | 1,052 | https://github.com/cdglabs/apparatus/blob/c2564482c7207389c163d3f99ccf564d0eae351a/src/View/CreatePanel.coffee | 1 | 42 |
cdglabs/apparatus:src/View/CreatePanel.coffee:2:raw_corpus | raw_corpus | propTypes:
element: Model.Element
render: ->
element = @props.element
R.div {
className: R.cx {
"CreatePanelItem": true
"isEditing": @_isEditing()
}
},
R.div {
className: "CreatePanelThumbnail"
onMouseDown: @_onMouseDown
},
R.Thumbnail {... | CoffeeScript | cdglabs/apparatus | src/View/CreatePanel.coffee | MIT | 0602d748e673dd7d20f053ac660f8e41601c5dc5 | 1,052 | https://github.com/cdglabs/apparatus/blob/0602d748e673dd7d20f053ac660f8e41601c5dc5/src/View/CreatePanel.coffee | 44 | 84 | ||
cdglabs/apparatus:src/View/CreatePanel.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
propTypes:
element: Model.Element
render: ->
element = @props.element
R.div {
className: R.cx {
"CreatePanelItem": true
"isEditing": @_isEditing()
}
},
R.div {
className: "CreatePanelThumbnail"
... | ({
propTypes: {
element: Model.Element
},
render: function() {
var element;
element = this.props.element;
return R.div({
className: R.cx({
"CreatePanelItem": true,
"isEditing": this._isEditing()
})
}, R.div({
className: "CreatePanelThumbnail",
onMouseDow... | CoffeeScript | JavaScript | cdglabs/apparatus | src/View/CreatePanel.coffee | MIT | 0602d748e673dd7d20f053ac660f8e41601c5dc5 | 1,052 | https://github.com/cdglabs/apparatus/blob/0602d748e673dd7d20f053ac660f8e41601c5dc5/src/View/CreatePanel.coffee | 44 | 84 |
cdglabs/apparatus:src/View/CreatePanel.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
propTypes: {
element: Model.Element
},
render: function() {
var element;
element = this.props.element;
return R.div({
className: R.cx({
"CreatePanelItem": true,
"isEditing": this._isEditing()
})
}, R.div({
... | propTypes:
element: Model.Element
render: ->
element = @props.element
R.div {
className: R.cx {
"CreatePanelItem": true
"isEditing": @_isEditing()
}
},
R.div {
className: "CreatePanelThumbnail"
onMouseDown: @_onMouseDown
},
R.Thumbnail {... | JavaScript | CoffeeScript | cdglabs/apparatus | src/View/CreatePanel.coffee | MIT | 0602d748e673dd7d20f053ac660f8e41601c5dc5 | 1,052 | https://github.com/cdglabs/apparatus/blob/0602d748e673dd7d20f053ac660f8e41601c5dc5/src/View/CreatePanel.coffee | 44 | 84 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.