Example #1
0
      ).subscribe(([section, isFullscreen]) => {
        this.content.resize();

        // Hack to make it happen after resize is done
        setTimeout(() => {
          this.calculateOffset(section, isFullscreen);
        }, 0);
      });
Example #2
0
 this.notificationService.getNotificationListForTop(position, isNeedRegistNotExistsReadStatus, this.keyWord).then((data: any) => {
     this.notificationListForTop = data;
     this.isLoadCompleted = true;
     this.isScrollToTopButtonVisible = false;
     if (isRefresh) {
         refresher.complete();
     }
     if (this.isFirstTimeLoad && data.length > 9) {
         this.pageContent.scrollTo(0, 46);
         this.isShowSearchBar = true;
         this.isFirstTimeLoad = false;
     }
 });
 (childNodes: TreeNode[]) => {
     this.folderItems = {};
     // we found all children of the node we're
     // traversing to (key)
     for (let i in childNodes) {
         let childNode: TreeNode = childNodes[i],
             childKey: number = childNode[DB_KEY_PATH];
         newFolderItems[childKey] = childNode;
     } // for
     this.folderNode = folderNode;
     this.folderItems = newFolderItems;
     // resize content, because a change in this.folderNode
     // can affect the header's visibility
     this.content.resize();
 },
  //Function called once the view is full loaded
  ionViewDidEnter() {

    //Scroll to the bottom of the messages (Request below is for polling, not getting messages)
    this.content.scrollToBottom(this.scrollDuration);

    //Grab our user from localstorage
    let user = JSON.parse(localStorage.getItem(AppSettings.shushItemName));

    //Start polling to get messages
    let poll = this.appMessaging.conversationRequestPoll(user.access_token);

    //Get a reference to this
    let self = this;

    this.pollingRequest = poll.subscribe(function(success) {
      //Success!

      //Stop loading
      self.appNotify.stopLoading().then(function() {

        //Add our messages/Get our conversation
        self.appMessaging.conversations = success;

        //Update our conversations
        self.updateConversation();
      });
    }, function(error) {
      //Error!

      //Stop Loading
      self.appNotify.stopLoading().then(function() {
        //Pass to Error Handler
        self.appNotify.handleError(error, [{
          status: 404,
          callback: function() {
            //Pop back to the All conversations view

            self.navCtrl.pop();
          }
        }]);
      });

    }, function() {
      //Completed
    })
  }
Example #5
0
File: home.ts Project: KajB/WatchIT
        setTimeout(() => {
            let screenHeight: number = this.maincontent.getNativeElement().clientHeight;
            let sizes: PosterPercentageItem[] = [];

            for (let i = 0; i < this.tmdbConfig.images.poster_sizes.length; i++) {
                let posterSize: string = this.tmdbConfig.images.poster_sizes[i];
                let size: number = +posterSize.substring(1, posterSize.length);
                let percentage: number = (size / screenHeight) * 100;

                if (!isNaN(percentage)) {
                    sizes.push({ percentage: percentage, posterSize: posterSize, size: size });
                }
            }

            var closestPercentage = findClosest(sizes.map(x => x.percentage), 40);
            this.posterWidth = sizes.find(x => x.percentage == closestPercentage).posterSize;
            this.imageHeight = this.scrollHeight = screenHeight * 0.4;
        }, 0);
  //Function to update our conversation
  updateConversation() {

    //Find and update our current conversation
    for (let i = 0; i < this.appMessaging.conversations.length; ++i) {
      if (this.convoId == this.appMessaging.conversations[i]._id) {

        //Update the conversation
        this.convo = this.appMessaging.conversations[i];

        //Break from the loop
        i = this.appMessaging.conversations.length;
      }
    }

    //Update the UI
    this.changeDetector.detectChanges();

    //Scroll to the bottom of the messages
    this.content.scrollToBottom(this.scrollDuration);
  }
Example #7
0
 scrollToIndexPageTop(): void {
     this.pageContent.scrollToTop();
 }
Example #8
0
 public guideLineContent5(){
   this.content.scrollTo(0, this.guideline5.nativeElement.offsetTop, 500);
 }
Example #9
0
 public scrollToTop(){
   this.content.scrollToTop();
 }
 scrollToBottom(){
   this.content.scrollToBottom(300);//300ms animation speed
 }