forked from praya/ember-cli-pace-gs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
3,330 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
var RSVP = require('rsvp'); | ||
|
||
module.exports = { | ||
normalizeEntityName: function() {}, | ||
|
||
afterInstall: function() { | ||
return RSVP.all([ | ||
this.addPackageToProject('pace-progress'), | ||
]); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,103 @@ | ||
/* jshint node: true */ | ||
'use strict'; | ||
|
||
var fs = require('fs'); | ||
var path = require('path'); | ||
var UglifyJS = require("uglify-js"); | ||
var PACE_DIR = 'pace-progress'; | ||
|
||
var _paceConfig = {}; | ||
var _defaultPaceConfig = { | ||
color: 'blue', | ||
theme: 'minimal', | ||
catchupTime: 50, | ||
initialRate: 0.01, | ||
minTime: 100, | ||
ghostTime: 50, | ||
maxProgressPerFrame: 20, | ||
easeFactor: 1.25, | ||
startOnPageLoad: true, | ||
restartOnPushState: true, | ||
restartOnRequestAfter: 500, | ||
target: 'body', | ||
elements: { | ||
checkInterval: 100, | ||
selectors: ['body', '.ember-view'] | ||
}, | ||
eventLag: { | ||
minSamples: 10, | ||
sampleCount: 3, | ||
lagThreshold: 3 | ||
}, | ||
ajax: { | ||
trackMethods: ['GET', 'POST', 'DELETE', 'OPTIONS'], | ||
trackWebSockets: true, | ||
ignoreURLs: [] | ||
} | ||
}; | ||
|
||
|
||
module.exports = { | ||
name: 'ember-cli-pace' | ||
name: 'ember-cli-pace', | ||
|
||
config: function (environment, baseConfig) { | ||
if ('pace' in baseConfig) { | ||
if (!baseConfig.pace) { | ||
_paceConfig = false; | ||
} else { | ||
Object.keys(_defaultPaceConfig).forEach(function (key) { | ||
_paceConfig[key] = baseConfig.pace.hasOwnProperty(key) ? baseConfig.pace[key] : _defaultPaceConfig[key]; | ||
}); | ||
} | ||
} else { | ||
_paceConfig = _defaultPaceConfig; | ||
} | ||
|
||
if (environment === 'development') { | ||
return { | ||
pace: _paceConfig, | ||
contentSecurityPolicy: { | ||
'script-src': "'self' 'unsafe-eval' 'unsafe-inline'" | ||
} | ||
}; | ||
} | ||
|
||
return { | ||
pace: _paceConfig | ||
}; | ||
}, | ||
|
||
treeFor: function (name) { | ||
if (_paceConfig && name === 'styles') { | ||
var paceThemeName = path.join(_paceConfig.color, 'pace-theme-' + _paceConfig.theme + '.css'), | ||
originalPaceThemePath = path.join('node_modules', PACE_DIR, 'themes', paceThemeName), | ||
addonPaceThemePath = path.join('vendor', 'ember-cli-pace', 'themes', paceThemeName); | ||
|
||
if (fs.existsSync(originalPaceThemePath)) { | ||
this.app.import(originalPaceThemePath); | ||
} else if (fs.existsSync(addonPaceThemePath)) { | ||
this.app.import(addonPaceThemePath); | ||
} else { | ||
throw new Error('Pace theme CSS file was not found: ' + paceThemeName); | ||
} | ||
} | ||
}, | ||
|
||
contentFor: function (name) { | ||
if (_paceConfig && name === 'head') { | ||
var paceScriptPath = path.join('node_modules', PACE_DIR, 'pace.js'), | ||
addonScriptPath = path.resolve(__dirname, 'vendor', 'ember-cli-pace', 'script-loader.js'), | ||
paceScript, addonScript; | ||
|
||
if (this.app.env === 'production') { | ||
paceScript = UglifyJS.minify(paceScriptPath).code; | ||
addonScript = UglifyJS.minify(addonScriptPath).code; | ||
} else { | ||
paceScript = fs.readFileSync(paceScriptPath, 'utf8'); | ||
addonScript = fs.readFileSync(addonScriptPath, 'utf8'); | ||
} | ||
|
||
return '<script type="text/javascript" data-pace-options=\'' + JSON.stringify(_paceConfig) + '\'>' + paceScript + ';\n' + addonScript + '</script>'; | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
{ | ||
"predef": [ | ||
"document", | ||
"window", | ||
"location", | ||
"setTimeout", | ||
"$", | ||
"-Promise", | ||
"define", | ||
"console", | ||
"visit", | ||
"exists", | ||
"fillIn", | ||
"click", | ||
"keyEvent", | ||
"triggerEvent", | ||
"find", | ||
"findWithAssert", | ||
"wait", | ||
"DS", | ||
"andThen", | ||
"currentURL", | ||
"currentPath", | ||
"currentRouteName" | ||
], | ||
"node": false, | ||
"browser": false, | ||
"boss": true, | ||
"curly": false, | ||
"debug": false, | ||
"devel": false, | ||
"eqeqeq": true, | ||
"evil": true, | ||
"forin": false, | ||
"immed": false, | ||
"laxbreak": false, | ||
"newcap": true, | ||
"noarg": true, | ||
"noempty": false, | ||
"nonew": false, | ||
"nomen": false, | ||
"onevar": false, | ||
"plusplus": false, | ||
"regexp": false, | ||
"undef": true, | ||
"sub": true, | ||
"strict": false, | ||
"white": false, | ||
"eqnull": true, | ||
"esnext": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import Ember from 'ember'; | ||
|
||
export default Ember.Controller.extend(Ember.PromiseProxyMixin, { | ||
page: 0, | ||
|
||
actions: { | ||
load: function () { | ||
var promise = $.ajax({ | ||
url: "https://andruxnet-random-famous-quotes.p.mashape.com/cat=movies", | ||
type: 'post', | ||
dataType: 'json', | ||
headers: { | ||
"X-Mashape-Key": "NmMfD3pY9dmshv8ZpOelB8xlmiOPp1JDlGtjsnwdRZKZ1cLgJn", | ||
"Content-Type": "application/x-www-form-urlencoded", | ||
"Accept": "application/json" | ||
} | ||
}); | ||
|
||
this.set('promise', promise); | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,9 @@ | ||
import EmberRouter from '@ember/routing/router'; | ||
import Ember from 'ember'; | ||
import config from './config/environment'; | ||
|
||
const Router = EmberRouter.extend({ | ||
location: config.locationType, | ||
rootURL: config.rootURL | ||
var Router = Ember.Router.extend({ | ||
location: config.locationType | ||
}); | ||
|
||
Router.map(function() { | ||
export default Router.map(function() { | ||
}); | ||
|
||
export default Router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
html, | ||
body { | ||
font-family: "Helvetica Neue", Arial, sans-serif; | ||
} | ||
|
||
article { | ||
padding: 40px; | ||
} | ||
|
||
button { | ||
background: black; | ||
color: white; | ||
border: 0 none; | ||
padding: 12px 20px; | ||
border-radius: 5px; | ||
font: inherit; | ||
font-weight: bold; | ||
cursor: pointer; | ||
outline: 0 none; | ||
} | ||
|
||
blockquote { | ||
border-left: 2px solid; | ||
margin: 30px 0; | ||
padding-left: 20px; | ||
} | ||
|
||
blockquote i { | ||
display: block; | ||
margin-top: 10px; | ||
font-family: serif; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,15 @@ | ||
<h2 id="title">Welcome to Ember</h2> | ||
<article> | ||
<h2>Welcome to Ember Pace.js Demo</h2> | ||
|
||
{{outlet}} | ||
<p> | ||
<button {{action 'load'}}>Load Quote</button> | ||
</p> | ||
|
||
{{#if isFulfilled}} | ||
<blockquote> | ||
{{model.quote}} | ||
<i>{{model.author}}</i> | ||
</blockquote> | ||
{{/if}} | ||
|
||
</article> |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.