Merge branch 'maint/7.0'
[ninja.git] / application / views / js / pnp.js
blobb1f830c854011c16fd1f8b9fd4a9c59e76c4f659
1 $(document).ready(function () {
2         $('#iframe').load(function() {
3                 $(this).focus();
4                 $(this.contentDocument).find('.ui-widget-header tr').each(function () {
5                         $(this).append('<td align="right"><a href="#" class="default" title="Make default graph" alt="Make default graph"><img src="' + _site_domain + '/application/views/icons/16x16/shield-ok.png"/></a></td>');
6                         $(this).find('.default').click(function() {
7                                 var src = $(this).closest('div').next('div').find('img').attr('src');
8                                 var match = src.match(/\?(.*)&view=(\d)&source=(\d)/);
9                                 $.ajax(
10                                         _site_domain + _index_page + '/ajax/pnp_default/',
11                                         {
12                                                 data: {
13                                                         param: match[1],
14                                                         view: match[2],
15                                                         source: match[3]
16                                                 },
17                                                 complete: function () {
18                                                         $.jGrowl(_settings_msg, {header: _success_header});
19                                                 },
20                                                 type: 'POST'
21                                         }
22                                 );
23                                 return false;
24                         });
25                 });
26         });
27 });