<commit_before>/*
* jQuery Mobile Framework : listview plugin
* Copyright (c) jQuery Project
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
* Note: Code is in draft form and is subject to change 
*/
(function( $ ) {

$.fn.listview = function( options ) {
	return this.each(function() {
		var $this = $( this ),
			parentID = $this.closest('.ui-page').attr('id')
		
		function data( type, defaultValue ) {
			var attr = "data-" + type,
				value = $this.attr( attr );
			return value === undefined ? defaultValue : value;
		}
		
		//split these to be able to reference o.theme
		var o = $.extend({
			theme: data( "theme", "f" )
		}, options );
		o = $.extend({	
			countTheme: data( "count-theme", o.theme ),
			headerTheme: "b",
			groupingTheme: data( "grouping-theme", "b" ),
			splitTheme: data( "split-theme", "b" ),
			inset: data( "inset", "false" ) === "true"
		}, o);
		
		//if it's a nested list, chunk it into ui-page items, recurse through them and call listview on each individual ul
		$( $this.find( "ul" ).get().reverse() ).each(function( i ) {
			var list = $( this ),
				id = parentID + "&" + jQuery.mobile.subPageUrlKey  + "=listview-" + i,
				parent = list.parent(),
				title = parent.contents()[ 0 ].nodeValue,
				theme = list.attr( "data-theme" ) !== undefined ?
					list.attr( "data-theme" ) :
					o.theme,
				countTheme = list.attr( "data-count-theme" ) !== undefined ?
					list.attr( "data-count-theme" ) :
					o.countTheme;
			
			list.wrap( "<div class='ui-page'><div class='ui-content'></div></div>" )
				.parent()
					.before( "<div class='ui-header ui-bar-" + o.headerTheme + "'><h1>" +
						title + "</h1><a href='#' class='ui-back' data-icon='arrow-l'>Back</a></div>" )
					.parent()
						.attr({
							id: id,
							"data-theme": theme,
							"data-count-theme": countTheme
						})
						.appendTo( "body" )
						.fixHeaderFooter()
						.find( ".ui-header a.ui-back" )
							.buttonMarkup()
							.click(function() {
								history.go(-1);
								return false;
							});
			
			parent.html( "<a href='#" + id + "'>" + title + "</a>" );
		}).listview();<commit_msg>Listview: Use .data() instead of .attr() for reading config values.<commit_after>/*
* jQuery Mobile Framework : listview plugin
* Copyright (c) jQuery Project
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
* Note: Code is in draft form and is subject to change 
*/
(function( $ ) {

$.fn.listview = function( options ) {
	return this.each(function() {
		var $this = $( this ),
			parentID = $this.closest('.ui-page').attr('id')
		
		//split these to be able to reference o.theme
		var o = $.extend({
			theme: $this.data( "theme" ) || "f"
		}, options );
		o = $.extend({	
			countTheme: $this.data( "count-theme" ) || o.theme,
			headerTheme: "b",
			groupingTheme: $this.data( "grouping-theme" ) || "b",
			splitTheme: $this.data( "split-theme" ) || "b",
			inset: $this.data( "inset" ) || false
		}, o);
		
		//if it's a nested list, chunk it into ui-page items, recurse through them and call listview on each individual ul
		$( $this.find( "ul" ).get().reverse() ).each(function( i ) {
			var list = $( this ),
				id = parentID + "&" + jQuery.mobile.subPageUrlKey  + "=listview-" + i,
				parent = list.parent(),
				title = parent.contents()[ 0 ].nodeValue,
				theme = list.data( "theme" ) || o.theme,
				countTheme = list.data( "count-theme" ) || o.countTheme;
			
			list.wrap( "<div class='ui-page'><div class='ui-content'></div></div>" )
				.parent()
					.before( "<div class='ui-header ui-bar-" + o.headerTheme + "'><h1>" +
						title + "</h1><a href='#' class='ui-back' data-icon='arrow-l'>Back</a></div>" )
					.parent()
						.attr({
							id: id,
							"data-theme": theme,
							"data-count-theme": countTheme
						})
						.appendTo( "body" )
						.fixHeaderFooter()
						.find( ".ui-header a.ui-back" )
							.buttonMarkup()
							.click(function() {
								history.go(-1);
								return false;
							});
			
			parent.html( "<a href='#" + id + "'>" + title + "</a>" );
		}).listview();
{'fraction_non_alphanumeric': 0.195821185617104, 'fraction_numerical': 0.001943634596695821, 'mean_word_length': 2.6923766816143497, 'pattern_counts': {'":': 4, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4864734', 'n_tokens_mistral': 1730, 'n_tokens_neox': 1388, 'n_words': 367}