<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh">
	<id>https://130.wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AElement%2FElectronConfiguration</id>
	<title>Module:Element/ElectronConfiguration - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="https://130.wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AElement%2FElectronConfiguration"/>
	<link rel="alternate" type="text/html" href="https://130.wiki/index.php?title=Module:Element/ElectronConfiguration&amp;action=history"/>
	<updated>2026-11-27T00:33:07Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://130.wiki/index.php?title=Module:Element/ElectronConfiguration&amp;diff=14566&amp;oldid=prev</id>
		<title>zhwiki&gt;Xiplus-abot：​已保护“Module:Element/ElectronConfiguration”：​高風險模板：507引用&lt;!-- 機器人3 --&gt;（[编辑=仅允许自动确认用户]（无限期）[移动=仅允许自动确认用户]（无限期））</title>
		<link rel="alternate" type="text/html" href="https://130.wiki/index.php?title=Module:Element/ElectronConfiguration&amp;diff=14566&amp;oldid=prev"/>
		<updated>2024-01-17T21:10:47Z</updated>

		<summary type="html">&lt;p&gt;已保护“&lt;a href=&quot;/wiki/Module:Element/ElectronConfiguration&quot; title=&quot;Module:Element/ElectronConfiguration&quot;&gt;Module:Element/ElectronConfiguration&lt;/a&gt;”：​高風險模板：507引用&amp;lt;!-- &lt;a href=&quot;/index.php?title=User:Xiplus-abot/task/3&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;User:Xiplus-abot/task/3（页面不存在）&quot; rel=&quot;nofollow&quot;&gt;機器人3&lt;/a&gt; --&amp;gt;（[编辑=仅允许自动确认用户]（无限期）[移动=仅允许自动确认用户]（无限期））&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local p={}&lt;br /&gt;
local lib_arg = {}&lt;br /&gt;
local eleconfdata = {&amp;#039;s&amp;#039;,&amp;#039;p&amp;#039;,&amp;#039;d&amp;#039;,&amp;#039;f&amp;#039;,&amp;#039;g&amp;#039;,&amp;#039;h&amp;#039;,&amp;#039;i&amp;#039;,&amp;#039;k&amp;#039;,&amp;#039;l&amp;#039;,&amp;#039;m&amp;#039;,&amp;#039;n&amp;#039;,&amp;#039;o&amp;#039;}&lt;br /&gt;
local element_main_data = mw.loadData(&amp;quot;Module:Element/data&amp;quot;)&lt;br /&gt;
local element_lib = require(&amp;quot;Module:Element&amp;quot;)&lt;br /&gt;
local utils = require( &amp;#039;Module:PeriodicTable/utils&amp;#039; )&lt;br /&gt;
function p.ElectronConfiguration(frame)&lt;br /&gt;
	return p._ElectronConfiguration(element_lib._loadArgFromFrame(frame))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local yesno = nil&lt;br /&gt;
&lt;br /&gt;
function p._ElectronConfiguration(args)&lt;br /&gt;
	--去除模板引用時可能產生的空格&lt;br /&gt;
	local eleString=&amp;#039;&amp;#039; if (args[1] and args[1] ~= &amp;#039;&amp;#039;) then eleString = mw.text.trim(args[1]) else return &amp;#039;&amp;#039; end&lt;br /&gt;
	local eleid = element_lib.getListID(eleString)&lt;br /&gt;
	local ele1 = p._copytable(element_main_data[eleid])&lt;br /&gt;
&lt;br /&gt;
	if (eleid==-1) then&lt;br /&gt;
		return &amp;#039;&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	if (ele1.correct and ele1.correct  ~= &amp;#039;&amp;#039;) then&lt;br /&gt;
		return &amp;#039;&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	local display_all = false&lt;br /&gt;
	if args[&amp;quot;displayAll&amp;quot;] then&lt;br /&gt;
    	if type(yesno) ~= type(tonumber) then yesno = require(&amp;#039;Module:Yesno&amp;#039;) end&lt;br /&gt;
		display_all = yesno(args[&amp;quot;displayAll&amp;quot;] or &amp;#039;no&amp;#039;)&lt;br /&gt;
	end&lt;br /&gt;
	if (ele1.Z and ele1.Z ~= &amp;#039;&amp;#039;) then&lt;br /&gt;
		return p._eleconftostring(ele1.EC, display_all)&lt;br /&gt;
	end&lt;br /&gt;
	return &amp;#039;&amp;#039;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p._copytable(input_table)&lt;br /&gt;
	local output_table&lt;br /&gt;
	if type(input_table) == type({}) then&lt;br /&gt;
		output_table = {}&lt;br /&gt;
		for k,v in pairs(input_table) do&lt;br /&gt;
			local temp&lt;br /&gt;
			if type(input_table) == type({}) then&lt;br /&gt;
				temp = mw.clone(p._copytable(v))&lt;br /&gt;
			elseif type(input_table) == type(tonumber) then&lt;br /&gt;
			else&lt;br /&gt;
				temp = mw.copy(v)&lt;br /&gt;
			end&lt;br /&gt;
			output_table[k]=temp&lt;br /&gt;
		end&lt;br /&gt;
	elseif type(input_table) == type(tonumber) then&lt;br /&gt;
		--do nothing&lt;br /&gt;
	else&lt;br /&gt;
		output_table = mw.clone(input_table)&lt;br /&gt;
	end&lt;br /&gt;
	return output_table&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p._eleconftostring(eleconf, showall)&lt;br /&gt;
	local cen = eleconf.cen or &amp;#039;&amp;#039;&lt;br /&gt;
	local ceneledata&lt;br /&gt;
	if cen ~= &amp;#039;&amp;#039; then&lt;br /&gt;
		local eleid = element_lib.getListID(cen)&lt;br /&gt;
		ceneledata = p._copytable(element_main_data[eleid])&lt;br /&gt;
	end&lt;br /&gt;
	if not ceneledata then ceneledata = p._copytable(element_main_data[2]) end&lt;br /&gt;
	local elecdis = &amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
	for _period, eles in ipairs(eleconf) do&lt;br /&gt;
		local elecstr = &amp;#039;&amp;#039;&lt;br /&gt;
		local period = _period&lt;br /&gt;
		local shell_length = math.ceil((_period+1)/2)&lt;br /&gt;
		if not(showall == true) then --不顯示全部 照原始順序與數量&lt;br /&gt;
			shell_length = #eles&lt;br /&gt;
		end&lt;br /&gt;
		for shell_it=1,shell_length do&lt;br /&gt;
			if showall == true then --顯示全部: 能級交錯 (s,t不變，其餘-2，如7s 7p 6d 5f)&lt;br /&gt;
				period = _period - math.max(shell_it - 2,0)&lt;br /&gt;
			end --不顯示全部: 原樣&lt;br /&gt;
			if eleconf[period][shell_it] then&lt;br /&gt;
				local shell = shell_it&lt;br /&gt;
				local elecount = eleconf[period][shell_it]&lt;br /&gt;
				&lt;br /&gt;
				if type(elecount) == type({}) then--亞軌域&lt;br /&gt;
					for shell_id, shell_ent in ipairs(elecount) do&lt;br /&gt;
						local shellstr = &amp;#039;&amp;#039;&lt;br /&gt;
						local shell_name = shell_ent[2]&lt;br /&gt;
						local shell_elecount = shell_ent[1]&lt;br /&gt;
						local valence = shell_elecount&lt;br /&gt;
						local censhell_ent = ((ceneledata.EC[period] or {})[shell] or {{0,&amp;#039;&amp;#039;}})[shell_id]&lt;br /&gt;
						--尋找同名亞軌域&lt;br /&gt;
						local shell_ent_check = (ceneledata.EC[period] or {})[shell]&lt;br /&gt;
						if type(shell_ent_check) == type({}) then&lt;br /&gt;
							for subshell_id, subshell_ent in ipairs(shell_ent_check) do&lt;br /&gt;
								if subshell_ent[2] == shell_name then censhell_ent = {subshell_ent[1],subshell_ent[2]} break end&lt;br /&gt;
							end&lt;br /&gt;
						else&lt;br /&gt;
							censhell_ent = {shell_ent_check,&amp;#039;&amp;#039;}&lt;br /&gt;
						end&lt;br /&gt;
						if not(showall == true) then &lt;br /&gt;
							valence = valence - ((censhell_ent or {})[1] or 0)&lt;br /&gt;
						end&lt;br /&gt;
						if valence &amp;gt; 0 then&lt;br /&gt;
							local frame = mw.getCurrentFrame()&lt;br /&gt;
							&lt;br /&gt;
							--{{su|p=2|b=1/2}}&lt;br /&gt;
							shellstr = tostring(period) .. eleconfdata[shell] .. frame:expandTemplate{ title = &amp;#039;su&amp;#039;, args = { p=tostring(valence), b=tostring(shell_name) } }&lt;br /&gt;
							elecstr = elecstr .. shellstr&lt;br /&gt;
						end&lt;br /&gt;
					end&lt;br /&gt;
				else&lt;br /&gt;
					local shellstr = &amp;#039;&amp;#039;&lt;br /&gt;
					local valence = elecount&lt;br /&gt;
					if not(showall == true) then &lt;br /&gt;
						local subshell_name = &amp;#039;&amp;#039;&lt;br /&gt;
						local shell_ent = (ceneledata.EC[period] or {})[shell]&lt;br /&gt;
						if type(shell_ent) == type({}) then--亞軌域&lt;br /&gt;
							for subshell_id, subshell_ent in ipairs(shell_ent) do&lt;br /&gt;
								if subshell_ent[2] == subshell_name then shell_ent = subshell_ent[1] break end&lt;br /&gt;
							end&lt;br /&gt;
						end&lt;br /&gt;
						valence = valence - (shell_ent or 0) &lt;br /&gt;
					end&lt;br /&gt;
					if valence &amp;gt; 0 then&lt;br /&gt;
						shellstr = tostring(period) .. eleconfdata[shell] .. &amp;#039;&amp;lt;sup&amp;gt;&amp;#039; .. tostring(valence) .. &amp;#039;&amp;lt;/sup&amp;gt;&amp;#039;&lt;br /&gt;
						elecstr = elecstr .. shellstr&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
				&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		elecdis = elecdis .. elecstr&lt;br /&gt;
	end&lt;br /&gt;
	if cen ~= &amp;#039;&amp;#039; and not(showall == true) then&lt;br /&gt;
		elecdis = &amp;#039;[&amp;#039; .. cen .. &amp;#039;]&amp;#039; .. elecdis&lt;br /&gt;
	end&lt;br /&gt;
	return elecdis&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.ElectronShell(frame)&lt;br /&gt;
	return p._electronShell(element_lib._loadArgFromFrame(frame))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p._electronShell(args)&lt;br /&gt;
	--去除模板引用時可能產生的空格&lt;br /&gt;
	local eleString=&amp;#039;&amp;#039; if (args[1] and args[1] ~= &amp;#039;&amp;#039;) then eleString = mw.text.trim(args[1]) else return &amp;#039;&amp;#039; end&lt;br /&gt;
	local eleid = element_lib.getListID(eleString)&lt;br /&gt;
	local ele1 = p._copytable(element_main_data[eleid])&lt;br /&gt;
&lt;br /&gt;
	if (eleid==-1) then&lt;br /&gt;
		return &amp;#039;&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	if (ele1.correct and ele1.correct  ~= &amp;#039;&amp;#039;) then&lt;br /&gt;
		return &amp;#039;&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	local comma = &amp;#039;,&amp;#039;&lt;br /&gt;
	if args[&amp;quot;comma&amp;quot;] and args[&amp;quot;comma&amp;quot;]~=&amp;#039;&amp;#039; then comma = args[&amp;quot;comma&amp;quot;] or comma end&lt;br /&gt;
	if (ele1.Z and ele1.Z ~= &amp;#039;&amp;#039;) then&lt;br /&gt;
		return p._eleshelltostring(ele1.EC, display_all)&lt;br /&gt;
	end&lt;br /&gt;
	return &amp;#039;&amp;#039;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p._eleshelltostring(eleconf, _comma)&lt;br /&gt;
	local comma=_comma or&amp;#039;,&amp;#039;&lt;br /&gt;
	local elecdis = &amp;#039;&amp;#039;&lt;br /&gt;
	for period, eles in ipairs(eleconf) do&lt;br /&gt;
		local ele_shell_count = 0&lt;br /&gt;
		for shell, elecount in ipairs(eles) do&lt;br /&gt;
			if type(elecount) == type({}) then&lt;br /&gt;
				for shell_id, shell_ent in ipairs(elecount) do&lt;br /&gt;
					local shell_name = shell_ent[2]&lt;br /&gt;
					local shell_elecount = shell_ent[1]&lt;br /&gt;
					ele_shell_count = ele_shell_count + shell_elecount&lt;br /&gt;
				end&lt;br /&gt;
			else&lt;br /&gt;
				ele_shell_count = ele_shell_count + elecount&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		if elecdis~=&amp;#039;&amp;#039; then elecdis=elecdis..comma end&lt;br /&gt;
		elecdis=elecdis..tostring(ele_shell_count)&lt;br /&gt;
	end&lt;br /&gt;
	return elecdis&lt;br /&gt;
end&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>zhwiki&gt;Xiplus-abot</name></author>
	</entry>
</feed>