reduce requests
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -7,3 +7,4 @@ public/components
|
||||
.settings/
|
||||
components/
|
||||
css/bundle.css
|
||||
js/bowr.js
|
||||
|
||||
1
GAnalytics.js
Normal file
1
GAnalytics.js
Normal file
@@ -0,0 +1 @@
|
||||
!function(e,n,t,a,i,c,o){e.GoogleAnalyticsObject=i,e[i]=e[i]||function(){(e[i].q=e[i].q||[]).push(arguments)},e[i].l=1*new Date,c=n.createElement(t),o=n.getElementsByTagName(t)[0],c.async=1,c.src=a,o.parentNode.insertBefore(c,o)}(window,document,"script","//www.google-analytics.com/analytics.js","ga"),ga("create","UA-60676910-1","auto"),ga("send","pageview");var appInsights=window.appInsights||function(e){function n(e){i[e]=function(){var n=arguments;i.queue.push(function(){i[e].apply(i,n)})}}var t,a,i={config:e},c=document,o=window,r="script",s=c.createElement(r);for(s.src=e.url||"//az416426.vo.msecnd.net/scripts/a/ai.0.js",c.getElementsByTagName(r)[0].parentNode.appendChild(s),i.cookie=c.cookie,i.queue=[],t=["Event","Exception","Metric","PageView","Trace"];t.length;)n("track"+t.pop());return e.disableExceptionTracking||(t="onerror",n("_"+t),a=o[t],o[t]=function(e,n,c,o,r){var s=a&&a(e,n,c,o,r);return s!==!0&&i["_"+t](e,n,c,o,r),s}),i}({instrumentationKey:"8ca49161-65fa-4f75-af00-fc302149575f"});window.appInsights=appInsights,appInsights.trackPageView();
|
||||
@@ -7,13 +7,9 @@
|
||||
"components"
|
||||
],
|
||||
"dependencies": {
|
||||
"jquery": "~2.1.4",
|
||||
"bootstrap": "~3.3.5",
|
||||
"mustache": "~2.1.2",
|
||||
"jquery-rss": "~1.5.1",
|
||||
"install": "~1.0.4",
|
||||
"jquery.easing": "~1.3.1",
|
||||
"lodestoneapi.min": "http://xivsync.com/lodestoneapi.min.js",
|
||||
"font-awesome": "~4.3.0"
|
||||
"jquery.easing": "~1.3.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ IF EXIST "%DEPLOYMENT_TARGET%\package.json" (
|
||||
:: 4. Install gulp
|
||||
IF EXIST "%DEPLOYMENT_TARGET%\gulpfile.js" (
|
||||
pushd "%DEPLOYMENT_TARGET%"
|
||||
call :ExecuteCmd !NPM_CMD! install gulp gulp-cache-bust gulp-concat-css gulp-uglify html-minifier
|
||||
call :ExecuteCmd !NPM_CMD! install gulp gulp-cache-bust gulp-concat-css gulp-uglify html-minifier gulp-concat
|
||||
call .\node_modules\.bin\gulp publish
|
||||
IF !ERRORLEVEL! NEQ 0 goto error
|
||||
popd
|
||||
|
||||
13
gulpfile.js
13
gulpfile.js
@@ -7,7 +7,8 @@ var gulp = require('gulp'),
|
||||
cachebust = require('gulp-cache-bust'),
|
||||
minifyCss = require('gulp-minify-css'),
|
||||
minify = require('html-minifier').minify,
|
||||
fs = require("fs");
|
||||
fs = require("fs"),
|
||||
concat = require('gulp-concat');
|
||||
|
||||
|
||||
|
||||
@@ -58,8 +59,15 @@ gulp.task('develop', function () {
|
||||
});
|
||||
|
||||
gulp.task('minifyJs', function() {
|
||||
return gulp.src('js/*.js')
|
||||
return gulp.src(['js/*.js', 'components/**/*.min.js'])
|
||||
.pipe(uglify())
|
||||
.pipe(concat('bowr.js'))
|
||||
.pipe(gulp.dest('js'));
|
||||
});
|
||||
|
||||
gulp.task('combineJs', function() {
|
||||
return gulp.src(['js/*.js', 'components/**/*.min.js'])
|
||||
.pipe(concat('bowr.js'))
|
||||
.pipe(gulp.dest('js'));
|
||||
});
|
||||
|
||||
@@ -82,6 +90,7 @@ gulp.task('publish', [
|
||||
|
||||
gulp.task('default', [
|
||||
'develop',
|
||||
'combineJs',
|
||||
'combineCss',
|
||||
'watch'
|
||||
]);
|
||||
|
||||
22
index.html
22
index.html
@@ -11,9 +11,9 @@
|
||||
<link rel="shortcut icon" href="/img/favicon.ico">
|
||||
<link href="https://fonts.googleapis.com/css?family=Lato:300,400,300italic,400italic" rel="stylesheet" type="text/css">
|
||||
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet" type="text/css">
|
||||
<link rel="stylesheet" href="/components/bootstrap/dist/css/bootstrap.css">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
|
||||
|
||||
<link rel="stylesheet" href="/components/font-awesome/css/font-awesome.min.css">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
|
||||
|
||||
<link rel="stylesheet" href="/css/bundle.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/octicons/2.0.2/octicons.min.css">
|
||||
@@ -23,8 +23,7 @@
|
||||
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
<meta name="google-site-verification" content="G4psmFLJd9nwPIr3OFJoSdrwqodMweq1oipofawZIdc">
|
||||
<script async type="text/javascript" src="/js/GAnalytics.min.js"></script>
|
||||
<script type="text/javascript" src="/js/appInsight.js"></script>
|
||||
<script type="text/javascript" src="/GAnalytics.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<header class="header">
|
||||
@@ -291,16 +290,11 @@
|
||||
<small class="copyright">tommyparnell.com</small>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="/components/moment/min/moment.min.js"></script>
|
||||
<script src="/components/jquery/dist/jquery.min.js"></script>
|
||||
<script src="/js/respond.js"></script>
|
||||
<script src="/components/mustache/mustache.min.js"></script>
|
||||
<script src="/components/jquery-rss/dist/jquery.rss.min.js"></script>
|
||||
<script src="/components/jquery.easing/js/jquery.easing.min.js"></script>
|
||||
<script src="/components/lodestoneapi.min/index.js"></script>
|
||||
<script src="/components/bootstrap/dist/js/bootstrap.min.js"></script>
|
||||
<script src="/js/GithubActivity.js"></script>
|
||||
<script src="/js/main.js"></script>
|
||||
|
||||
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment.min.js"></script>
|
||||
<script src="/js/bowr.js"></script>
|
||||
|
||||
</body>
|
||||
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m);
|
||||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||
|
||||
ga('create', 'UA-60676910-1', 'auto');
|
||||
ga('send', 'pageview');
|
||||
2
js/GAnalytics.min.js
vendored
2
js/GAnalytics.min.js
vendored
@@ -1,2 +0,0 @@
|
||||
(function(n,t,i,r,u,f,e){n.GoogleAnalyticsObject=u;n[u]=n[u]||function(){(n[u].q=n[u].q||[]).push(arguments)};n[u].l=1*new Date;f=t.createElement(i);e=t.getElementsByTagName(i)[0];f.async=1;f.src=r;e.parentNode.insertBefore(f,e)})(window,document,"script","//www.google-analytics.com/analytics.js","ga");ga("create","UA-60676910-1","auto");ga("send","pageview");
|
||||
//# sourceMappingURL=GAnalytics.min.js.map
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"version":3,
|
||||
"file":"GAnalytics.min.js",
|
||||
"lineCount":1,
|
||||
"mappings":"CAAG,QAAQ,CAACA,CAAC,CAACC,CAAC,CAACC,CAAC,CAACC,CAAC,CAACC,CAAC,CAACC,CAAC,CAACC,CAAb,CAAe,CAACN,CAAEO,sBAAwB,CAACH,CAAC,CAACJ,CAAE,CAAAI,CAAA,CAAE,CAACJ,CAAE,CAAAI,CAAA,CAAE,EAAE,QAAQ,CAAA,CAAE,CACvE,CAACJ,CAAE,CAAAI,CAAA,CAAEI,EAAE,CAACR,CAAE,CAAAI,CAAA,CAAEI,EAAE,EAAE,CAAA,CAAhB,CAAmBC,KAAK,CAACC,SAAD,CAD+C,C,CAClCV,CAAE,CAAAI,CAAA,CAAEO,EAAE,CAAC,CAAC,CAAC,IAAIC,I,CAAOP,CAAC,CAACJ,CAACY,cAAc,CAACX,CAAD,C,CAC1EI,CAAC,CAACL,CAACa,qBAAqB,CAACZ,CAAD,CAAI,CAAA,CAAA,C,CAAGG,CAACU,MAAM,CAAC,CAAC,CAACV,CAACW,IAAI,CAACb,CAAC,CAACG,CAACW,WAAWC,aAAa,CAACb,CAAC,CAACC,CAAH,CAFtD,EAGtB,CAACa,MAAM,CAACC,QAAQ,CAAC,QAAQ,CAAC,yCAAyC,CAAC,IAApE,CAAyE,CAE7EC,EAAE,CAAC,QAAQ,CAAE,eAAe,CAAE,MAA5B,CAAmC,CACrCA,EAAE,CAAC,MAAM,CAAE,UAAT,CAAoB",
|
||||
"sources":["GAnalytics.js"],
|
||||
"names":["i","s","o","g","r","a","m","GoogleAnalyticsObject","q","push","arguments","l","Date","createElement","getElementsByTagName","async","src","parentNode","insertBefore","window","document","ga"]
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
var appInsights=window.appInsights||function(config){
|
||||
function s(config){t[config]=function(){var i=arguments;t.queue.push(function(){t[config].apply(t,i)})}}var t={config:config},r=document,f=window,e="script",o=r.createElement(e),i,u;for(o.src=config.url||"//az416426.vo.msecnd.net/scripts/a/ai.0.js",r.getElementsByTagName(e)[0].parentNode.appendChild(o),t.cookie=r.cookie,t.queue=[],i=["Event","Exception","Metric","PageView","Trace"];i.length;)s("track"+i.pop());return config.disableExceptionTracking||(i="onerror",s("_"+i),u=f[i],f[i]=function(config,r,f,e,o){var s=u&&u(config,r,f,e,o);return s!==!0&&t["_"+i](config,r,f,e,o),s}),t
|
||||
}({
|
||||
instrumentationKey:"8ca49161-65fa-4f75-af00-fc302149575f"
|
||||
});
|
||||
|
||||
window.appInsights=appInsights;
|
||||
appInsights.trackPageView();
|
||||
@@ -1,150 +0,0 @@
|
||||
/* --------------------------------------------------
|
||||
* XIVPads.com (v5) - Lodestone API (Javascript)
|
||||
* This runs off: XIVSync.com
|
||||
*
|
||||
* > requires jquery.
|
||||
* --------------------------------------------------
|
||||
* API calls will match those of the PHP API, so for
|
||||
* example, you can do:
|
||||
*
|
||||
* LodestoneAPI.Search.Character(Name, Server);
|
||||
* LodestoneAPI.Search.Character(123456);
|
||||
*/
|
||||
var LodestoneAPI =
|
||||
{
|
||||
logEnabled: false,
|
||||
|
||||
paths:
|
||||
{
|
||||
sync: 'http://xivsync.com',
|
||||
search: '/search/character',
|
||||
character: '/character/get',
|
||||
},
|
||||
|
||||
// Initialize
|
||||
init: function()
|
||||
{
|
||||
LodestoneAPI.log('init()');
|
||||
|
||||
// check for jquery.
|
||||
if (typeof window.jQuery == 'undefined') {
|
||||
console.error('Please include https://jquery.com/, this API requires it.');
|
||||
}
|
||||
},
|
||||
|
||||
// wrapper for ajaxing
|
||||
get: function(url, data, callback)
|
||||
{
|
||||
LodestoneAPI.log('get', url);
|
||||
LodestoneAPI.log('get', data);
|
||||
|
||||
$.ajax({
|
||||
url: url,
|
||||
data: data,
|
||||
crossDomain: true,
|
||||
dataType: 'json',
|
||||
success: function(data)
|
||||
{
|
||||
LodestoneAPI.log('get > return', data);
|
||||
if (data.ok) {
|
||||
return callback(data.data);
|
||||
}
|
||||
|
||||
console.error('XIVSync API Error: '+ data.msg);
|
||||
return callback(false);
|
||||
},
|
||||
error: function(data, status, error)
|
||||
{
|
||||
console.error('Error attempting to ajax to: ' + url);
|
||||
console.error(status);
|
||||
console.error(error);
|
||||
console.error('Please open an issue on Github: https://github.com/viion/XIVPads-LodestoneAPI');
|
||||
return callback(false);
|
||||
},
|
||||
})
|
||||
},
|
||||
|
||||
// Logging
|
||||
log: function(text, data)
|
||||
{
|
||||
if (LodestoneAPI.logEnabled) {
|
||||
if (data) {
|
||||
console.log('[LODESTONE-API]', text, data);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('[LODESTONE-API]', text);
|
||||
}
|
||||
},
|
||||
|
||||
// Search for thingz
|
||||
Search:
|
||||
{
|
||||
Character: function(nameOrId, server, callback, recurrsive)
|
||||
{
|
||||
if (!callback || typeof callback !== 'function') {
|
||||
console.error('Callback function not defined.');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!nameOrId) {
|
||||
console.error('Name or ID is empty');
|
||||
return callback(false);
|
||||
}
|
||||
|
||||
// if numeric, can just get character
|
||||
// else we have to search!
|
||||
if ($.isNumeric(nameOrId))
|
||||
{
|
||||
LodestoneAPI.log('search > character > isNumeric = true =', nameOrId);
|
||||
|
||||
var url = LodestoneAPI.paths.sync + LodestoneAPI.paths.character,
|
||||
data = { lodestone: nameOrId }
|
||||
|
||||
LodestoneAPI.get(url, data, function(data)
|
||||
{
|
||||
// if empty
|
||||
if (data.length == 0) {
|
||||
return callback(false);
|
||||
}
|
||||
|
||||
return callback(data);
|
||||
});
|
||||
}
|
||||
else if (!recurrsive)
|
||||
{
|
||||
LodestoneAPI.log('search > character > isNumeric = false =', nameOrId);
|
||||
|
||||
var url = LodestoneAPI.paths.sync + LodestoneAPI.paths.search,
|
||||
data = { name: nameOrId, server: server }
|
||||
|
||||
// get
|
||||
LodestoneAPI.get(url, data, function(data)
|
||||
{
|
||||
// if empty
|
||||
if (data.length == 0) {
|
||||
return callback(false);
|
||||
}
|
||||
|
||||
|
||||
// Try match server and name
|
||||
for (var i in data)
|
||||
{
|
||||
var c = data[i];
|
||||
if (c.name == nameOrId && c.world == server && $.isNumeric(c.i));
|
||||
{
|
||||
// recurrsive callback on character using id
|
||||
LodestoneAPI.log('search > character > recurrsion with id:', c.id);
|
||||
LodestoneAPI.Search.Character(c.id, null, callback, true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
LodestoneAPI.log('search > character > no results for: ', nameOrId);
|
||||
return callback(false);
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
LodestoneAPI.init();
|
||||
@@ -11,6 +11,7 @@
|
||||
"devDependencies": {
|
||||
"gulp": "~3.8.10",
|
||||
"gulp-cache-bust": "^1.0.1",
|
||||
"gulp-concat": "^2.6.0",
|
||||
"gulp-concat-css": "^2.2.0",
|
||||
"gulp-less": "~3.0.1",
|
||||
"gulp-livereload": "~3.8.0",
|
||||
|
||||
Reference in New Issue
Block a user