Socket
Socket
Sign inDemoInstall

any-downloader-vue

Package Overview
Dependencies
0
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.2 to 0.0.3

130

dist/index.js

@@ -1,71 +0,75 @@

'use strict';
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.AnyDownloader = factory());
}(this, (function () { 'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
function __async(g){return new Promise(function(s,j){function c(a,x){try{var r=g[x?"throw":"next"](a);}catch(e){j(e);return}r.done?s(r.value):Promise.resolve(r.value).then(c,d);}function d(e){c(e,1);}c();})}
function __async(g){return new Promise(function(s,j){function c(a,x){try{var r=g[x?"throw":"next"](a);}catch(e){j(e);return}r.done?s(r.value):Promise.resolve(r.value).then(c,d);}function d(e){c(e,1);}c();})}
var ResourcePreview = {
render: function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"mt-12 flex items-center justify-center flex-wrap"},[_c('div',{staticClass:"rounded-t bg-gray-700 w-full bg-cover bg-blend-soft-light",style:({backgroundImage: 'url(' + _vm.previewImage.url + ')'})},[(_vm.previewVideo && _vm.previewVideo.url)?_c('video',{staticClass:"rounded m-auto max-h-3/5-screen",attrs:{"controls":"true"}},[_c('source',{attrs:{"src":_vm.previewVideo.url}})]):_vm._e(),_vm._v(" "),((!_vm.previewVideo || !_vm.previewVideo.url) && _vm.previewImage && _vm.previewImage.url)?_c('img',{staticClass:"rounded-t",attrs:{"src":_vm.previewImage.url}}):_vm._e()]),_vm._v(" "),_c('div',{staticClass:"bg-white text-black rounded-b p-6 w-full"},[(_vm.attributes.author)?_c('p',{staticClass:"text-sm text-center pb-2"},[(_vm.attributes.author.avatar && _vm.attributes.author.avatar.url)?_c('img',{staticClass:"rounded-full w-12 h-12 inline",attrs:{"alt":_vm.attributes.author.nickname,"src":_vm.attributes.author.avatar.url}}):_vm._e(),_vm._v("\n "+_vm._s(_vm.attributes.author.full_name)+"\n ")]):_vm._e(),_vm._v(" "),(_vm.attributes.title)?_c('p',{staticClass:"text-lg pb-2"},[_vm._v("\n "+_vm._s(_vm.attributes.title)+"\n ")]):_vm._e(),_vm._v(" "),(_vm.attributes.text)?_c('p',[_vm._v("\n "+_vm._s(_vm.attributes.text)+"\n ")]):_vm._e(),_vm._v(" "),(_vm.attributes.hashtags && _vm.attributes.hashtags.length)?_c('p',[_vm._v("\n "+_vm._s(_vm.attributes.hashtags.map( function (v) { return '#' + v; }).join(', '))+"\n ")]):_vm._e(),_vm._v(" "),_c('div',{staticClass:"flex mt-6 justify-center flex-wrap"},[(_vm.items.video && _vm.items.video.length)?_c('div',{staticClass:"mx-0.5 mb-3"},[_c('h4',{staticClass:"bg-gray-700 rounded-t text-gray-100 py-2"},[_vm._v("Videos")]),_vm._v(" "),_vm._l((_vm.items.video),function(item){return _c('a',{staticClass:"my-1.5 rounded bg-gradient-to-r from-pink-500 via-pink-600 to-pink-700 shadow hover:from-red-500 hover:to-purple-400 block font-extrabold px-2 py-2 text-gray-100",attrs:{"target":"_blank","href":item.url}},[_vm._v("Download "+_vm._s(item.title)+"."+_vm._s(item.format))])})],2):_vm._e(),_vm._v(" "),(_vm.items.image && _vm.items.image.length)?_c('div',{staticClass:"mx-0.5 mb-3"},[_c('h4',{staticClass:"bg-gray-700 rounded-t text-gray-100 py-2"},[_vm._v("Images")]),_vm._v(" "),_vm._l((_vm.items.image),function(item){return _c('a',{staticClass:"my-1.5 rounded bg-gradient-to-r from-pink-500 via-pink-600 to-pink-700 shadow hover:from-red-500 hover:to-purple-400 block font-extrabold px-2 py-2 text-gray-100",attrs:{"target":"_blank","href":item.url}},[_vm._v("Download "+_vm._s(item.title)+"."+_vm._s(item.format))])})],2):_vm._e(),_vm._v(" "),(_vm.items.audio && _vm.items.audio.length)?_c('div',{staticClass:"mx-0.5 mb-3"},[_c('h4',{staticClass:"bg-gray-700 rounded-t text-gray-100 py-2"},[_vm._v("Audio")]),_vm._v(" "),_vm._l((_vm.items.audio),function(item){return _c('a',{staticClass:"my-1.5 rounded bg-gradient-to-r from-pink-500 via-pink-600 to-pink-700 shadow hover:from-red-500 hover:to-purple-400 block font-extrabold px-2 py-2 text-gray-100",attrs:{"target":"_blank","href":item.url}},[_vm._v("Download "+_vm._s(item.title)+"."+_vm._s(item.format))])})],2):_vm._e(),_vm._v(" "),(_vm.items.text && _vm.items.text.length)?_c('div',{staticClass:"mx-0.5 mb-3"},[_c('h4',{staticClass:"bg-gray-700 rounded-t text-gray-100 py-2"},[_vm._v("Text/Subtitles")]),_vm._v(" "),_vm._l((_vm.items.text),function(item){return _c('a',{staticClass:"my-1.5 rounded bg-gradient-to-r from-pink-500 via-pink-600 to-pink-700 shadow hover:from-red-500 hover:to-purple-400 block font-extrabold px-2 py-2 text-gray-100",attrs:{"target":"_blank","href":item.url}},[_vm._v("Download "+_vm._s(item.title)+"."+_vm._s(item.format))])})],2):_vm._e()])])])},
staticRenderFns: [],
props: ['sourceUrl', 'previewImage', 'previewVideo', 'attributes', 'items']
};
var ResourcePreview = {
render: function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"mt-12 flex items-center justify-center flex-wrap"},[_c('div',{staticClass:"rounded-t bg-gray-700 w-full bg-cover bg-blend-soft-light",style:({backgroundImage: 'url(' + _vm.previewImage.url + ')'})},[(_vm.previewVideo && _vm.previewVideo.url)?_c('video',{staticClass:"rounded m-auto max-h-3/5-screen",attrs:{"controls":"true"}},[_c('source',{attrs:{"src":_vm.previewVideo.url}})]):_vm._e(),_vm._v(" "),((!_vm.previewVideo || !_vm.previewVideo.url) && _vm.previewImage && _vm.previewImage.url)?_c('img',{staticClass:"rounded-t",attrs:{"src":_vm.previewImage.url}}):_vm._e()]),_vm._v(" "),_c('div',{staticClass:"bg-white text-black rounded-b p-6 w-full"},[(_vm.attributes.author)?_c('p',{staticClass:"text-sm text-center pb-2"},[(_vm.attributes.author.avatar && _vm.attributes.author.avatar.url)?_c('img',{staticClass:"rounded-full w-12 h-12 inline",attrs:{"alt":_vm.attributes.author.nickname,"src":_vm.attributes.author.avatar.url}}):_vm._e(),_vm._v("\n "+_vm._s(_vm.attributes.author.full_name)+"\n ")]):_vm._e(),_vm._v(" "),(_vm.attributes.title)?_c('p',{staticClass:"text-lg pb-2"},[_vm._v("\n "+_vm._s(_vm.attributes.title)+"\n ")]):_vm._e(),_vm._v(" "),(_vm.attributes.text)?_c('p',[_vm._v("\n "+_vm._s(_vm.attributes.text)+"\n ")]):_vm._e(),_vm._v(" "),(_vm.attributes.hashtags && _vm.attributes.hashtags.length)?_c('p',[_vm._v("\n "+_vm._s(_vm.attributes.hashtags.map( function (v) { return '#' + v; }).join(', '))+"\n ")]):_vm._e(),_vm._v(" "),_c('div',{staticClass:"flex mt-6 justify-center flex-wrap"},[(_vm.items.video && _vm.items.video.length)?_c('div',{staticClass:"mx-0.5 mb-3"},[_c('h4',{staticClass:"bg-gray-700 rounded-t text-gray-100 py-2"},[_vm._v("Videos")]),_vm._v(" "),_vm._l((_vm.items.video),function(item){return _c('a',{staticClass:"my-1.5 rounded bg-gradient-to-r from-pink-500 via-pink-600 to-pink-700 shadow hover:from-red-500 hover:to-purple-400 block font-extrabold px-2 py-2 text-gray-100",attrs:{"target":"_blank","href":item.url}},[_vm._v("Download "+_vm._s(item.title)+"."+_vm._s(item.format))])})],2):_vm._e(),_vm._v(" "),(_vm.items.image && _vm.items.image.length)?_c('div',{staticClass:"mx-0.5 mb-3"},[_c('h4',{staticClass:"bg-gray-700 rounded-t text-gray-100 py-2"},[_vm._v("Images")]),_vm._v(" "),_vm._l((_vm.items.image),function(item){return _c('a',{staticClass:"my-1.5 rounded bg-gradient-to-r from-pink-500 via-pink-600 to-pink-700 shadow hover:from-red-500 hover:to-purple-400 block font-extrabold px-2 py-2 text-gray-100",attrs:{"target":"_blank","href":item.url}},[_vm._v("Download "+_vm._s(item.title)+"."+_vm._s(item.format))])})],2):_vm._e(),_vm._v(" "),(_vm.items.audio && _vm.items.audio.length)?_c('div',{staticClass:"mx-0.5 mb-3"},[_c('h4',{staticClass:"bg-gray-700 rounded-t text-gray-100 py-2"},[_vm._v("Audio")]),_vm._v(" "),_vm._l((_vm.items.audio),function(item){return _c('a',{staticClass:"my-1.5 rounded bg-gradient-to-r from-pink-500 via-pink-600 to-pink-700 shadow hover:from-red-500 hover:to-purple-400 block font-extrabold px-2 py-2 text-gray-100",attrs:{"target":"_blank","href":item.url}},[_vm._v("Download "+_vm._s(item.title)+"."+_vm._s(item.format))])})],2):_vm._e(),_vm._v(" "),(_vm.items.text && _vm.items.text.length)?_c('div',{staticClass:"mx-0.5 mb-3"},[_c('h4',{staticClass:"bg-gray-700 rounded-t text-gray-100 py-2"},[_vm._v("Text/Subtitles")]),_vm._v(" "),_vm._l((_vm.items.text),function(item){return _c('a',{staticClass:"my-1.5 rounded bg-gradient-to-r from-pink-500 via-pink-600 to-pink-700 shadow hover:from-red-500 hover:to-purple-400 block font-extrabold px-2 py-2 text-gray-100",attrs:{"target":"_blank","href":item.url}},[_vm._v("Download "+_vm._s(item.title)+"."+_vm._s(item.format))])})],2):_vm._e()])])])},
staticRenderFns: [],
props: ['sourceUrl', 'previewImage', 'previewVideo', 'attributes', 'items']
};
function Resource(ref) {
var source_url = ref.source_url;
var preview_image = ref.preview_image;
var preview_video = ref.preview_video;
var attributes = ref.attributes;
var items = ref.items;
function Resource(ref) {
var source_url = ref.source_url;
var preview_image = ref.preview_image;
var preview_video = ref.preview_video;
var attributes = ref.attributes;
var items = ref.items;
this.sourceUrl = source_url;
this.previewImage = preview_image;
this.previewVideo = preview_video;
this.attributes = attributes;
this.items = items;
}
this.sourceUrl = source_url;
this.previewImage = preview_image;
this.previewVideo = preview_video;
this.attributes = attributes;
this.items = items;
}
var AnyDownloader = {
render: function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"my-10"},[_c('div',{staticClass:"relative text-gray-700"},[_c('input',{directives:[{name:"model",rawName:"v-model",value:(_vm.url),expression:"url"}],staticClass:"w-full h-10 pl-3 pr-8 text-base placeholder-gray-600 border rounded-lg focus:shadow-outline",attrs:{"type":"text","placeholder":_vm.inputPlaceholder},domProps:{"value":(_vm.url)},on:{"input":function($event){if($event.target.composing){ return; }_vm.url=$event.target.value;}}}),_vm._v(" "),_c('button',{staticClass:"absolute outline-none inset-y-0 right-0 flex items-center px-4 font-bold text-white bg-pink-700 rounded-r-lg border-pink-100 hover:bg-pink-500 focus:bg-pink-600",attrs:{"disabled":_vm.isLoading},on:{"click":_vm.get}},[(_vm.isLoading)?_c('svg',{staticClass:"animate-spin -ml-1 mr-3 h-5 w-5 text-white",attrs:{"xmlns":"http://www.w3.org/2000/svg","fill":"none","viewBox":"0 0 24 24"}},[_c('circle',{staticClass:"opacity-25",attrs:{"cx":"12","cy":"12","r":"10","stroke":"currentColor","stroke-width":"4"}}),_vm._v(" "),_c('path',{staticClass:"opacity-75",attrs:{"fill":"currentColor","d":"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"}})]):_vm._e(),_vm._v("\n "+_vm._s(_vm.btnText)+"\n ")])]),_vm._v(" "),(_vm.resource)?_c('resource-preview',_vm._b({key:_vm.resource.sourceUrl},'resource-preview',_vm.resource,false)):_vm._e()],1)},
staticRenderFns: [],
components: {ResourcePreview: ResourcePreview},
props: {
apiUrl: String,
inputPlaceholder: String,
defaultInputValue: String,
btnText: String
},
mounted: function mounted() {
this.url = this.defaultInputValue;
},
data: function data() {
return {
resource: null,
isLoading: false,
url: ''
};
},
methods: {
get: function get() {return __async(function*(){
var this$1$1 = this;
var AnyDownloader = {
render: function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"my-10"},[_c('div',{staticClass:"relative text-gray-700"},[_c('input',{directives:[{name:"model",rawName:"v-model",value:(_vm.url),expression:"url"}],staticClass:"w-full h-10 pl-3 pr-8 text-base placeholder-gray-600 border rounded-lg focus:shadow-outline",attrs:{"type":"text","placeholder":_vm.inputPlaceholder},domProps:{"value":(_vm.url)},on:{"input":function($event){if($event.target.composing){ return; }_vm.url=$event.target.value;}}}),_vm._v(" "),_c('button',{staticClass:"absolute outline-none inset-y-0 right-0 flex items-center px-4 font-bold text-white bg-pink-700 rounded-r-lg border-pink-100 hover:bg-pink-500 focus:bg-pink-600",attrs:{"disabled":_vm.isLoading},on:{"click":_vm.get}},[(_vm.isLoading)?_c('svg',{staticClass:"animate-spin -ml-1 mr-3 h-5 w-5 text-white",attrs:{"xmlns":"http://www.w3.org/2000/svg","fill":"none","viewBox":"0 0 24 24"}},[_c('circle',{staticClass:"opacity-25",attrs:{"cx":"12","cy":"12","r":"10","stroke":"currentColor","stroke-width":"4"}}),_vm._v(" "),_c('path',{staticClass:"opacity-75",attrs:{"fill":"currentColor","d":"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"}})]):_vm._e(),_vm._v("\n "+_vm._s(_vm.btnText)+"\n ")])]),_vm._v(" "),(_vm.resource)?_c('resource-preview',_vm._b({key:_vm.resource.sourceUrl},'resource-preview',_vm.resource,false)):_vm._e()],1)},
staticRenderFns: [],
components: {ResourcePreview: ResourcePreview},
props: {
apiUrl: String,
inputPlaceholder: String,
defaultInputValue: String,
btnText: String
},
mounted: function mounted() {
this.url = this.defaultInputValue;
},
data: function data() {
return {
resource: null,
isLoading: false,
url: ''
};
},
methods: {
get: function get() {return __async(function*(){
var this$1$1 = this;
if (!this.url) {
return;
}
this.isLoading = true;
window.axios.get(this.apiUrl, {params: {url: this.url}})
.then(function (res) {
this$1$1.resource = new Resource(res.data.data);
}).catch(function (err) {
if (err.response && err.response.data && err.response.data.message) {
alert(err.response.data.message);
} else {
alert('Something went wrong');
}
}).finally(function () {
this$1$1.isLoading = false;
});
}.call(this))}
}
};
if (!this.url) {
return;
}
this.isLoading = true;
window.axios.get(this.apiUrl, {params: {url: this.url}})
.then(function (res) {
this$1$1.resource = new Resource(res.data.data);
}).catch(function (err) {
if (err.response && err.response.data && err.response.data.message) {
alert(err.response.data.message);
} else {
alert('Something went wrong');
}
}).finally(function () {
this$1$1.isLoading = false;
});
}.call(this))}
}
};
return AnyDownloader;
exports.default = AnyDownloader;
})));

@@ -5,3 +5,3 @@ {

"license": "MIT",
"version": "0.0.2",
"version": "0.0.3",
"keywords": [

@@ -15,5 +15,5 @@ "downloader",

"author": {
"name": "Oleksandr Pinchuk",
"email": "intracomof@gmail.com",
"url": "https://iwannacode.net"
"name": "Oleksandr Pinchuk",
"email": "intracomof@gmail.com",
"url": "https://iwannacode.net"
},

@@ -24,8 +24,3 @@ "repository": {

},
"main": "dist/any-downloader.umd.js",
"module": "dist/any-downloader.esm.js",
"unpkg": "dist/any-downloader.min.js",
"browser": {
"./sfc": "src/components/AnyDownloader.vue"
},
"main": "dist/index.js",
"devDependencies": {

@@ -43,2 +38,2 @@ "@rollup/plugin-buble": "^0.21.3",

}
}
}

@@ -16,12 +16,6 @@ import commonjs from '@rollup/plugin-commonjs'; // Convert CommonJS modules to ES6

{
file: 'build/any-downloader.js',
file: './dist/index.js',
name: 'AnyDownloader',
format: 'umd'
},
{
file: 'dist/index.js',
format: 'cjs',
name: 'AnyDownloader',
exports: 'named'
},
}
],

@@ -36,6 +30,6 @@ plugins: [

buble({
transforms: { generator: false },
exclude: 'node_modules/**'
transforms: { generator: false },
exclude: 'node_modules/**'
}), // Transpile to ES5
],
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc