Hello again,

didn't expected You overwrite that js file from scratch, thank you. Your 
code works like a charm. I'll study Your code for further work, and if next 
time i come across with similar problem i will know how to solve it. Thank 
you again.
P.S. Hope that work didn't take much time from You.


понедельник, 24 февраля 2014 г., 19:40:30 UTC+2 пользователь jgeerdes [AJAX 
APIs "Guru"] написал:
>
> Okay, so the main problem is an issue of scope in the for loop that you're 
> using. To fix that, you need to use what's called a method closure. But 
> there are several other problems as well (e.g., you have multiple elements 
> with the id ao_news_item). So I went ahead and rewrote the code so that it 
> works. I would encourage you to take a look through it to see some of the 
> stuff I did (e.g., the method closure). To use the code, you'll need to 
> replace your ao_load_feed.js with the one attached. Because I changed the 
> elements from div#ao_news_item to div.ao_news_item you'll also need to go 
> into web-main.css and change line 170 to read as follows:
>
> .ao_news_item{
>
> Hope that helps.
>
> jg
>
>
>
>
>
> On Mon, Feb 24, 2014 at 11:38 AM, Rev. Jeremy R. Geerdes <
> [email protected] <javascript:>> wrote:
>
>> Okay, so the main problem is an issue of scope in the for loop that 
>> you're using. To fix that, you need to use what's called a method closure. 
>> But there are several other problems as well (e.g., you have multiple 
>> elements with the id ao_news_item). So I went ahead and rewrote the code so 
>> that it works. To use the code, you'll need to replace your ao_load_feed.js 
>> with the one attached. Because I changed the elements from div#ao_news_item 
>> to div.ao_news_item you'll also need to go into web-main.css and change 
>> line 170 to read as follows:
>>
>> .ao_news_item{
>>
>> Hope that helps.
>>
>>
>> On Mon, Feb 24, 2014 at 9:45 AM, Sergey Ivanov 
>> <[email protected]<javascript:>
>> > wrote:
>>
>>> Hi,
>>> I tried to use += instead of = but result is the same. the feeds loads 
>>> corectly (three feeds) but when click on feed modal window shows third feed 
>>> title and content (third feed is the oldest by date). Here im providing 
>>> link to my web page, the page is unfinished and i have a lot of work to do. 
>>> And i hope that russian language doesn't makes much difficulty. If You take 
>>> a look to page code then You will see that feeds generates automaticaly and 
>>> there is no code on page, there is just link to javascript in head, and 
>>> <div> with proper id for placing feeds inside.
>>>
>>> There is page - http://nfoxinc.ru
>>>
>>> понедельник, 24 февраля 2014 г., 4:42:16 UTC+2 пользователь jgeerdes 
>>> [AJAX APIs "Guru"] написал:
>>>>
>>>> You're overwriting the container.innerHTML with every news entry. Use 
>>>> += instead of = .
>>>>
>>>> And if that doesn't fix the problem, please post a link to the page, 
>>>> working or not, so we can see the code in action. It's generally much 
>>>> easier to debug things that way than by reading plain code, particularly 
>>>> when formatting isn't preserved.
>>>>
>>>> jg
>>>>
>>>>
>>>> On Sun, Feb 23, 2014 at 8:41 PM, Rev. Jeremy R. Geerdes <jgee...@
>>>> debraheightswesleyan.org> wrote:
>>>>
>>>>> You're overwriting the container.innerHTML with every news entry. Use 
>>>>> += instead of = .
>>>>>
>>>>> And if that doesn't fix the problem, please post a link to the page, 
>>>>> working or not, so we can see the code in action. It's generally much 
>>>>> easier to debug things that way than by reading plain code, particularly 
>>>>> when formatting isn't preserved.
>>>>>
>>>>> jg
>>>>>
>>>>>
>>>>> On Sun, Feb 23, 2014 at 4:14 PM, Sergey Ivanov <[email protected]>wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> Im stuck at showing feed content in modal window, the problem is that 
>>>>>> modal window always shows the same content and same title and i have no 
>>>>>> idea how to fix it. Can anyone give me advice or sample how to resolve 
>>>>>> my 
>>>>>> problem. Below is the code i use.
>>>>>>
>>>>>> google.load("feeds", "1");
>>>>>>
>>>>>> function initialize(){
>>>>>> var feed = new google.feeds.Feed("http://allods.mail.ru/newsrss.php?
>>>>>> line=news");
>>>>>>  feed.setNumEntries(3);
>>>>>> feed.load(function(result){
>>>>>> if (!result.error) {
>>>>>>  var container = document.getElementById("ao_news");
>>>>>> var feed_html = '';
>>>>>> for (var i = 0; i < result.feed.entries.length; i++) {
>>>>>>  var entry = result.feed.entries[i];
>>>>>>
>>>>>>               var date_val = new Date(entry.publishedDate);
>>>>>>
>>>>>>               moment.lang('ru');
>>>>>>
>>>>>>                         var ao_news_content = '';
>>>>>>                         ao_news_content +=entry.content;
>>>>>> feed_html +='<div id="ao_news_item"><a class="ao_news_title" href="' 
>>>>>> + entry.link + '" target="_blank">' + entry.title + '</a><div 
>>>>>> class="ao_news_snippet">' +entry.contentSnippet + '</div><span 
>>>>>> class="ao_news_time">' + moment(date_val).fromNow() + '</span></div>' ;
>>>>>>  }            
>>>>>> container.innerHTML = feed_html;
>>>>>>                         $('#ao_read_full').html(ao_news_content);
>>>>>>  }
>>>>>>         $(document).ready(function(){
>>>>>>             $('#ao_read_full').dialog({
>>>>>>                 autoOpen:false,
>>>>>>                 width:800,
>>>>>>                 height:600,
>>>>>>                 modal:true,
>>>>>>                 title:entry.title
>>>>>>             });
>>>>>>             
>>>>>>             $('#ao_news #ao_news_item').each(function(){
>>>>>>                 $(this).click(function(){
>>>>>>                 $('#ao_read_full').dialog('open');
>>>>>>
>>>>>>             });
>>>>>>
>>>>>>             });
>>>>>>         
>>>>>>         });
>>>>>> });
>>>>>> }google.setOnLoadCallback(initialize);
>>>>>>
>>>>>>  Legend - #ao_read_full - dialog modal window
>>>>>>              #ao_news - container that holds #ao_news_item
>>>>>>              #ao_news_item - that is feed
>>>>>>
>>>>>> -- 
>>>>>> -- 
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "Google AJAX APIs" group.
>>>>>> To post to this group, send email to
>>>>>> [email protected]
>>>>>>
>>>>>> To unsubscribe from this group, send email to
>>>>>> [email protected]
>>>>>> To view this message on the web, visit
>>>>>> https://groups.google.com/d/msgid/google-ajax-search-api/
>>>>>> 68b60f5a-3a1b-4ba9-b582-595c792fec56%40googlegroups.com
>>>>>> For more options, visit this group at
>>>>>> http://groups.google.com/group/google-ajax-search-api?hl=en?hl=en
>>>>>>  
>>>>>> --- 
>>>>>> You received this message because you are subscribed to the Google 
>>>>>> Groups "Google AJAX APIs" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it, 
>>>>>> send an email to [email protected].
>>>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> -- 
>>>>> Rev. Jeremy R. Geerdes, Pastor
>>>>> Debra Heights Wesleyan Church
>>>>> 4025 Lower Beaver Rd
>>>>>  Des Moines, IA 50310
>>>>>
>>>>> (515) 344-3037
>>>>> [email protected]
>>>>> http://www.debraheightswesleyan.org
>>>>>  
>>>>
>>>>
>>>>
>>>> -- 
>>>> Jeremy R. Geerdes
>>>> Generally Cool Guy
>>>> Des Moines, IA
>>>>
>>>> If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan 
>>>> Church!
>>>> http://www.debraheightswesleyan.org
>>>>  
>>>  -- 
>>> -- 
>>> You received this message because you are subscribed to the Google
>>> Groups "Google AJAX APIs" group.
>>> To post to this group, send email to
>>> [email protected] <javascript:>
>>> To unsubscribe from this group, send email to
>>> [email protected] <javascript:>
>>> To view this message on the web, visit
>>>
>>> https://groups.google.com/d/msgid/google-ajax-search-api/4428b960-33aa-4cb7-840e-9f4dfebdd0cc%40googlegroups.com
>>>
>>> For more options, visit this group at
>>> http://groups.google.com/group/google-ajax-search-api?hl=en?hl=en
>>>  
>>> --- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Google AJAX APIs" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected]<javascript:>
>>> .
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>
>>
>> -- 
>> Rev. Jeremy R. Geerdes, Pastor
>> Debra Heights Wesleyan Church
>> 4025 Lower Beaver Rd
>> Des Moines, IA 50310
>>
>> (515) 344-3037
>> [email protected] <javascript:>
>> http://www.debraheightswesleyan.org
>>  
>
>
>
> -- 
> Jeremy R. Geerdes
> Generally Cool Guy
> Des Moines, IA
>
> If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan 
> Church!
> http://www.debraheightswesleyan.org
>  

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Google AJAX APIs" group.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
To view this message on the web, visit
https://groups.google.com/d/msgid/google-ajax-search-api/16304b0f-dcf1-4a99-b701-a4b79ecba5b1%40googlegroups.com
For more options, visit this group at
http://groups.google.com/group/google-ajax-search-api?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"Google AJAX APIs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to