Ubuntu
/* global _ */
require( "./../scraper-store.js" );
var Scraper = function() {};
/**
* Scraper for the link field type.
*
* @param {Object} fields Fields to parse.
*
* @returns {Object} Mapped list of fields.
*/
Scraper.prototype.scrape = function( fields ) {
/**
* Set content for all link fields as a-tag with title, url and target.
* Return the fields object containing all fields.
*/
return _.map( fields, function( field ) {
if ( field.type !== "link" ) {
return field;
}
var title = field.$el.find( "input[type=hidden].input-title" ).val(),
url = field.$el.find( "input[type=hidden].input-url" ).val(),
target = field.$el.find( "input[type=hidden].input-target" ).val();
field.content = "" + title + "";
return field;
} );
};
module.exports = Scraper;