Jump to content

determine which javascript by page element


Recommended Posts

I am curious how one can tell what JavaScript is executed by inspecting say a tab element.

 

PS 1.6.0.6

 

I'm working in the back office localization-->countries-->edit country

 

How can I 'easily' determine what javascript is used when selecting one of these tabs.  (see screen shot below)

 

 

thanks from an old assembler programmer (but I did buy a JavaScript/PHP book, just need a boring time to read it) :)

 

 

Fore example: which javascrpt makes these tabs work?

 

http://screencast.com/t/kIthQUGctPXA

Link to comment
Share on other sites

basically I moved some javascript to the bottom, all looked fine until I was working in countries and these tabs don't work.

 

Here is the code that builds it, ave maria pues

 in AdminControllersCountries.php

		$html_tabnav = '<ul class="nav nav-tabs" id="custom-address-fields">';
		$html_tabcontent = '<div class="tab-content" >';

		$object_list = AddressFormat::getLiableClass('Address');
		$object_list['Address'] = null;

		// Get the available properties for each class
		$i = 0;
		$class_tab_active = 'active';
		foreach ($object_list as $class_name => &$object)
		{
			if ($i != 0){ $class_tab_active = ''; }
			$fields = array();
			$html_tabnav .= '<li class="'.$class_tab_active.'"">
				<a href="#availableListFieldsFor_'.$class_name.'"><i class="icon-caret-down"></i> '.Translate::getAdminTranslation($class_name, 'AdminCountries').'</a></li>';
			
			foreach (AddressFormat::getValidateFields($class_name) as $name)
				$fields[] = '<a href="javascript:void(0);" class="addPattern btn btn-default btn-xs" id="'.($class_name == 'Address' ? $name : $class_name.':'.$name).'">
					<i class="icon-plus-sign"></i> '.ObjectModel::displayFieldName($name, $class_name).'</a>';
			$html_tabcontent .= '
				<div class="tab-pane availableFieldsList panel '.$class_tab_active.'" id="availableListFieldsFor_'.$class_name.'">
				'.implode(' ', $fields).'</div>';
			unset($object);
			$i ++;
		}
		$html_tabnav .= '</ul>';
		$html_tabcontent .= '</div>';
		return $html = $html_tabnav.$html_tabcontent;

Link to comment
Share on other sites

ok, so by trial and error (story of my life), when I move admin.js top top it works fine.

 

that does not mean that topic is 'solved', would love to find an easy way to determine how a page element relates to a javascript.

 

I did buy a book php/javascript...but obviously I have not read it nor do I know if it would have helped for this question.

Link to comment
Share on other sites

Hi.

 

You mean you want to find out what events are attached to an element? Or just find the script that handles certain elements?

 

Regards.

 

Robin.

 

The CartExpert Team

Hi Robin,

 

yes, I'd like to be able to find what script handles  certain elements.  Now I have to move java up/down of page load to see if something works, there maybe 30 scripts to choose from.

 

Thanks  in advance for any tips that might help. 

Link to comment
Share on other sites

Hi El Patron.

 

There might be a better solution, but what I do if I can't identify the script by it's name, I try to 'guess' how the event is attached (what does the selector contain: class, id etc.), then I load all the javascript (can be done with Web Developer extension) and I just perform a search on it.

 

Regards.

Robin.

The CartExpert Team

  • Like 1
Link to comment
Share on other sites

Hi El Patron.

 

There might be a better solution, but what I do if I can't identify the script by it's name, I try to 'guess' how the event is attached (what does the selector contain: class, id etc.), then I load all the javascript (can be done with Web Developer extension) and I just perform a search on it.

 

Regards.

 

Robin.

 

The CartExpert Team

Thanks Robin for the tip.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...