gulp stuff
This commit is contained in:
parent
868b705b72
commit
80ace3866b
@ -17,6 +17,7 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"mui": "^0.9.20",
|
||||
"zepto": "^1.2.0"
|
||||
"zepto": "^1.2.0",
|
||||
"jquery": "^3.2.1"
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
const config = {};
|
||||
|
||||
config.db = {};
|
||||
config.webhost = 'http://nurl.co/';
|
||||
//config.webhost = 'http://nurl.co/';
|
||||
config.webhost = 'http://localhost:7000/';
|
||||
config.port = 7000;
|
||||
|
||||
config.db.host = 'localhost';
|
||||
|
@ -49,7 +49,7 @@ gulp.task('appJS', function() {
|
||||
|
||||
gulp.task('vendor', function() {
|
||||
return gulp.src([
|
||||
'bower_components/zepto/zepto.min.js',
|
||||
'bower_components/jquery/dist/jquery.min.js',
|
||||
'bower_components/mui/packages/cdn/js/mui.min.js'
|
||||
])
|
||||
.pipe(concat('vendor.js'))
|
||||
|
@ -1,39 +1,26 @@
|
||||
$('#btn-shorten').on('click', function(){
|
||||
function shorten(){
|
||||
$.ajax({
|
||||
url: '/api/v1/shorten',
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
data: {url: $('#url-field').val()},
|
||||
success: function(data){
|
||||
console.log('data', data);
|
||||
const $link = $('#link');
|
||||
const resultHTML = `<a class="result" href="${data.shortUrl}">${data.shortUrl}</a>`;
|
||||
$link.html(resultHTML);
|
||||
// $link.hide().fadeIn('slow');
|
||||
$link.hide().show();
|
||||
$link.hide().fadeIn('slow');
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$("#url-field").keyup(function(event){
|
||||
if(event.keyCode === 13){
|
||||
$("#btn-shorten").click();
|
||||
}
|
||||
});
|
||||
|
||||
$('#btn-shorten').on('click', function(){
|
||||
shorten();
|
||||
});
|
||||
|
||||
(function($) {
|
||||
$.extend($.fn, {
|
||||
fadeIn: function(ms) {
|
||||
if(typeof(ms) === 'undefined') ms = 500;
|
||||
|
||||
$(this).css({ display: 'block', opacity: 0 }).animate({ opacity: 1 }, ms);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
fadeOut: function(ms)
|
||||
{
|
||||
if(typeof(ms) === 'undefined') ms = 500;
|
||||
|
||||
$(this).css({ opacity: 1 }).animate({ opacity: 0 }, ms, 'linear', function() {
|
||||
$(this).css('display', 'none');
|
||||
});
|
||||
|
||||
return this;
|
||||
}
|
||||
});
|
||||
})(Zepto);
|
||||
|
@ -18,12 +18,10 @@
|
||||
<div class="mui--text-display3">nURL</div>
|
||||
<div class="mui--text-subhead">nurl.co</div>
|
||||
<div class="mui-panel">
|
||||
<form class="mui-form--inline">
|
||||
<div class="mui-textfield">
|
||||
<input type="text" id="url-field" placeholder="Paste a link...">
|
||||
<input id="url-field" placeholder="Paste a link...">
|
||||
</div>
|
||||
<button class="mui-btn mui-btn--raised mui-btn--accent" id="btn-shorten" type="button">SHORTEN</button>
|
||||
</form>
|
||||
<div class="mui-row">
|
||||
<div class="mui-col-lg-12" id="link"></div>
|
||||
</div>
|
||||
@ -32,7 +30,7 @@
|
||||
|
||||
<!--<script src="https://code.jquery.com/jquery-2.2.0.min.js"></script>-->
|
||||
<!-- build:vendor -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.2.0/zepto.js"></script>
|
||||
<script src="https://code.jquery.com/jquery-2.2.0.min.js"></script>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
|
||||
<!-- endbuild -->
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user