/*===================================================================
| jQuery Metal Clone Plugins
|===================================================================
| http://thunderwide.com
|
| @category Plugins
| @author Norlihazmey <[email protected]>
| @license Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
| and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
| @copyright (c) 2015 Norlihazmey(metallurgical)
| @version 1.3.0
| @Github https://github.com/metallurgical/jquery-metal-clone
|===================================================================*/
;
(function($) {
$.fn.metalClone = function(options, callback) {
opt = cloned = $.extend({}, $.fn.metalClone.defaults, options);
var base = clonedElement = this;
return base.each(function(index, elem) {
// if already defined or register
// clone plugin inside current selector
// then no need to redefined it
var classOrId = $(elem).attr('id') || $(elem).attr('class');
if (!classOrId) {
classOrId = elem;
}
if (undefined == $(document).data('metalClone-' + classOrId))
$(document).data('metalClone-' + classOrId, 'metalClone');
else
return;
// Get the selector
// To see either class or ids were used
var typeSelector = base.selector || '.' + classOrId,
// remove either . or # for class and ID respectively
newTypeSelector = typeSelector.replace(/^(\.|\#)/, ''),
nodeType = base[0].nodeName,
// Capture the configuration options
currentCopyValue = opt.copyValue,
currentPosition = opt.position,
currentNumberToClone = opt.numberToClone,
currentDestination =...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.