Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(...){
- newa.playlist[t].num = $('.tagEditor .num').val();
- newa.playlist[t].name = $('.tagEditor .name').val();
- newa.playlist[t].artist = $('.tagEditor .artist').val();
- newa.playlist[t].album = $('.tagEditor .album').val();
- newa.playlist[t].date = $('.tagEditor .date').val();
- }else if(...){
- newp.playlist[t].num = $('.tagEditor .num').val();
- newp.playlist[t].name = $('.tagEditor .name').val();
- newp.playlist[t].artist = $('.tagEditor .artist').val();
- newp.playlist[t].album = $('.tagEditor .album').val();
- newp.playlist[t].date = $('.tagEditor .date').val();
- }else if(...){
- newv.playlist[t].num = $('.tagEditor .num').val();
- newv.playlist[t].name = $('.tagEditor .name').val();
- newv.playlist[t].artist = $('.tagEditor .artist').val();
- newv.playlist[t].album = $('.tagEditor .album').val();
- newv.playlist[t].date = $('.tagEditor .date').val();
- }
- var fields = ['num', 'name', 'artist', 'album', 'date'],
- obj = newv;
- if(...) obj = newa;
- if(...) obj = newp;
- for(var i in fields) {
- obj.playlist[t][fields[i]] = $('.tagEditor .' + fields[i]).val();
- }
- for (var i in newa.playlist[t])
- {
- newa.playlist[t][i] = $('.tagEditor .' + i).val();
- }
- $.extractMetaData = (function (names/**array*/){
- return function (target/**jQuery|String*/){
- var data = {};
- $.each(names, function (i, name) {
- data[name] = $('.' + name, target).val();
- });
- return data;
- };
- })('num name artist album date'.split(' '));
- // Usage
- newa.playlist[t] = $.extractMetaData('.tagEditor');
- if(...){
- with( newa.playlist[t]){
- num = $('.tagEditor .num').val();
- name = $('.tagEditor .name').val();
- artist = $('.tagEditor .artist').val();
- album = $('.tagEditor .album').val();
- date = $('.tagEditor .date').val();
- }
- }else if(...){
- with( newp.playlist[t]){
- ...
- var X;
- if(...){
- X = newa.playlist[t];
- X.num = $('.tagEditor .num').val();
- X.name = $('.tagEditor .name').val();
- X.artist = $('.tagEditor .artist').val();
- X.album = $('.tagEditor .album').val();
- X.date = $('.tagEditor .date').val();
- }else if(...){
- X = newp.playlist[t];
- ...
- function xx(zz)
- {
- zz.num = $('.tagEditor .num').val();
- zz.name = $('.tagEditor .name').val();
- zz.artist = $('.tagEditor .artist').val();
- zz.album = $('.tagEditor .album').val();
- zz.date = $('.tagEditor .date').val();
- }
- if (..) {
- xx(newa.playlist[t]);
- }
- else if (..)
- {
- xx(newv.playlist[t]);
- }
- else
- xx(newp.playlist[t]);
- const props = [
- 'num',
- 'name',
- 'artist',
- 'album',
- 'date'
- ]
- function getval(element, t){
- for (const prop of props){
- element.playlist[t][prop] = $(`.tagEditor ${prop}`).val()
- }
- }
- if(...){
- getval(newa)
- }else if(...){
- getval(newp)
- }else if(...){
- getval(newv)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement