// RemovePage removes the page with the given name. If that page was the only
// visible page, visibility is assigned to the last page.
486118
func (p *Pages) RemovePage(name string) *Pages {
	var isVisible bool
	hasFocus := p.HasFocus()
	for index, page := range p.pages {
		if page.Name == name {
			isVisible = page.Visible
			p.pages = append(p.pages[:index], p.pages[index+1:]...)
			if page.Visible && p.changed != nil {
				p.changed()
			}
			break
		}
	}
	if isVisible {
		for index, page := range p.pages {
			if index < len(p.pages)-1 {
				if page.Visible {
					break // There is a remaining visible page.
				}
			} else {
				page.Visible = true // We need at least one visible page.
			}
		}
	}
	if hasFocus {
		p.Focus(p.setFocus)
	}
	return p
}
571995
func (s *IPRoleList) LastPage() (*IPRoleList, error) {
	return s.getPage(s.Meta.LastPageUri)
}
1130225
func (reg *Registry) Remove(printerName string) *Registry {
	reg.mu.Lock()
	for i, p := range reg.printers {
		if p.Name == printerName {
			reg.printers = append(reg.printers[:i], reg.printers[i+1:]...)
			break
		}
	}
	reg.mu.Unlock()
	return reg
}
1036874
func (c *Page) RemoveScriptToEvaluateOnNewDocument(identifier string) (*gcdmessage.ChromeResponse, error) {
	var v PageRemoveScriptToEvaluateOnNewDocumentParams
	v.Identifier = identifier
	return c.RemoveScriptToEvaluateOnNewDocumentWithParams(&v)
}
1105123
func (db *DB) page(id pgid) *page {
	pos := id * pgid(db.pageSize)
	return (*page)(unsafe.Pointer(&db.data[pos]))
}
278784
func (p *pageState) initPage() error {
	if _, err := p.init.Do(); err != nil {
		return err
	}
	return nil
}
376830
func (b *FileBookmarks) Remove(name string) bool {
	if b.Has(name) {
		delete(b.bookmarks, name)
		err := b.writeToFile()
		if err == nil {
			return true
		}
	}
	return false
}
787715
func PageHide(listener func(*vecty.Event)) *vecty.EventListener {
	return &vecty.EventListener{Name: "pagehide", Listener: listener}
}
422669
func (s *IPServiceList) LastPage() (*IPServiceList, error) {
	return s.getPage(s.Meta.LastPageUri)
}
650091
func (exp *explorerUI) AgendaPage(w http.ResponseWriter, r *http.Request) {
	errPageInvalidAgenda := func(err error) {
		log.Errorf("Template execute failure: %v", err)
		exp.StatusPage(w, defaultErrorCode, "the agenda ID given seems to not exist",
			"", ExpStatusNotFound)
	}

	// Attempt to get agendaid string from URL path.
	agendaId := getAgendaIDCtx(r)
	agendaInfo, err := exp.agendasSource.AgendaInfo(agendaId)
	if err != nil {
		errPageInvalidAgenda(err)
		return
	}

	summary, err := exp.explorerSource.AgendasVotesSummary(agendaId)
	if err != nil {
		log.Errorf("fetching Cumulative votes choices count failed: %v", err)
	}

	// Overrides the default count value with the actual vote choices count
	// matching data displayed on "Cumulative Vote Choices" and "Vote Choices By
	// Block" charts.
	var totalVotes uint32
	for index := range agendaInfo.Choices {
		switch strings.ToLower(agendaInfo.Choices[index].ID) {
		case "abstain":
			agendaInfo.Choices[index].Count = summary.Abstain
		case "yes":
			agendaInfo.Choices[index].Count = summary.Yes
		case "no":
			agendaInfo.Choices[index].Count = summary.No
		}
		totalVotes += agendaInfo.Choices[index].Count
	}

	ruleChangeI := exp.ChainParams.RuleChangeActivationInterval
	qVotes := uint32(float64(ruleChangeI) * agendaInfo.QuorumProgress)

	var timeLeft string
	blocksLeft := summary.LockedIn - exp.Height()

	if blocksLeft > 0 {
		// Approximately 1 block per 5 minutes.
		var minPerblock = 5 * time.Minute

		hoursLeft := int((time.Duration(blocksLeft) * minPerblock).Hours())
		if hoursLeft > 0 {
			timeLeft = fmt.Sprintf("%v days %v hours", hoursLeft/24, hoursLeft%24)
		}
	} else {
		blocksLeft = 0
	}

	str, err := exp.templates.execTemplateToString("agenda", struct {
		*CommonPageData
		Ai            *agendas.AgendaTagged
		QuorumVotes   uint32
		RuleChangeI   uint32
		VotingStarted int64
		LockedIn      int64
		BlocksLeft    int64
		TimeRemaining string
		TotalVotes    uint32
	}{
		CommonPageData: exp.commonData(r),
		Ai:             agendaInfo,
		QuorumVotes:    qVotes,
		RuleChangeI:    ruleChangeI,
		VotingStarted:  summary.VotingStarted,
		LockedIn:       summary.LockedIn,
		BlocksLeft:     blocksLeft,
		TimeRemaining:  timeLeft,
		TotalVotes:     totalVotes,
	})

	if err != nil {
		log.Errorf("Template execute failure: %v", err)
		exp.StatusPage(w, defaultErrorCode, defaultErrorMessage, "", ExpStatusError)
		return
	}
	w.Header().Set("Content-Type", "text/html")
	w.WriteHeader(http.StatusOK)
	io.WriteString(w, str)
}
587549
func (p Page) Summary() (summary string) {
	out, err := sanitize.HTMLAllowing(p.Body, []string{"p"})
	if err != nil {
		log.Println(err)
		return ""
	}
	if strings.Index(out, "\n") > 10 && strings.Index(out, "\n") < 255 {
		return strings.SplitN(out, "\n", 2)[0]
	}
	arr := strings.Split(out, " ")
	if len(arr) < 2 {
		return p.Body
	}
	var cnt = 0
	for i, v := range arr {
		cnt += len(v)
		if cnt > 255 {
			summary = strings.Join(arr[:i-1], " ")
			break
		}
	}
	return
}
1205257
func (s *ReactionsService) Remove(name string) *ReactionsRemoveCall {
	var call ReactionsRemoveCall
	call.service = s
	call.name = name
	return &call
}
65969
func (f *FingerprintResponse) RemoveLink(name string) {
	// initialize Links if it has not been already
	if f.Links == nil {
		f.Links = make(map[string]string, 0)
	}

	f.Links[name] = ""
}
791115
func (a *addrBook) RemoveAddress(addr *p2p.NetAddress) {
	a.mtx.Lock()
	defer a.mtx.Unlock()

	ka := a.addrLookup[addr.ID]
	if ka == nil {
		return
	}
	a.Logger.Info("Remove address from book", "addr", addr)
	a.removeFromAllBuckets(ka)
}
1332091
func (c *ReactionsListCall) Page(page int) *ReactionsListCall {
	c.page = page
	return c
}
568237
func (s *IPServiceList) NextPage() (*IPServiceList, error) {
	if !s.HasNextPage() {
		return nil, Error{"No next page"}
	}

	return s.getPage(s.Meta.NextPageUri)
}
588763
func (s *IPCredentialList) LastPage() (*IPCredentialList, error) {
	return s.getPage(s.Meta.LastPageUri)
}